Commit 79a52ba8 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix a possible crash when creating a KoColorPopup action

This could happen if there are no kocolorset objects in the
resource server.

BUG:393508
parent 21e8384d
......@@ -44,15 +44,18 @@ class KoColorPopupAction::KoColorPopupActionPrivate
{
public:
KoColorPopupActionPrivate()
: colorSetWidget(0), colorChooser(0), opacitySlider(0), menu(0), checkerPainter(4)
, showFilter(true), applyMode(true), firstTime(true)
: colorSetWidget(0)
, colorChooser(0)
, opacitySlider(0)
, menu(0)
, checkerPainter(4)
, showFilter(true)
, applyMode(true)
, firstTime(true)
{}
~KoColorPopupActionPrivate()
{
delete colorSetWidget;
delete colorChooser;
delete opacitySlider;
delete menu;
}
......@@ -79,12 +82,12 @@ KoColorPopupAction::KoColorPopupAction(QObject *parent)
QWidgetAction *wdgAction = new QWidgetAction(d->menu);
d->colorSetWidget = new KoColorSetWidget(widget);
KoResourceServer<KoColorSet>* rServer = KoResourceServerProvider::instance()->paletteServer();
QPointer<KoColorSet> defaultColorSet = rServer->resourceByName("Default");
if (defaultColorSet) {
d->colorSetWidget->setColorSet(defaultColorSet);
} else {
d->colorSetWidget->setColorSet(rServer->resources().first());
if (!defaultColorSet && rServer->resources().count() > 0) {
defaultColorSet = rServer->resources().first();
}
d->colorSetWidget->setColorSet(defaultColorSet);
d->colorChooser = new KoTriangleColorSelector( widget );
// prevent mouse release on color selector from closing popup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment