Commit a42c7e91 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Check whether the colorset is valid before using it

CCBUG:392712
parent 65ed3b4f
......@@ -38,7 +38,7 @@
#include <QHBoxLayout>
#include <QGridLayout>
#include <QToolButton>
#include <QPointer>
class KoColorPopupAction::KoColorPopupActionPrivate
{
......@@ -79,7 +79,7 @@ KoColorPopupAction::KoColorPopupAction(QObject *parent)
QWidgetAction *wdgAction = new QWidgetAction(d->menu);
d->colorSetWidget = new KoColorSetWidget(widget);
KoResourceServer<KoColorSet>* rServer = KoResourceServerProvider::instance()->paletteServer();
KoColorSet* defaultColorSet = rServer->resourceByName("Default");
QPointer<KoColorSet> defaultColorSet = rServer->resourceByName("Default");
if (defaultColorSet) {
d->colorSetWidget->setColorSet(defaultColorSet);
} else {
......
......@@ -286,8 +286,9 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::setColorFromString(QString s)
colorTriggered(patchWidgetList.at(i));
}
void KoColorSetWidget::setColorSet(KoColorSet *colorSet)
void KoColorSetWidget::setColorSet(QPointer<KoColorSet> colorSet)
{
if (!colorSet) return;
if (colorSet == d->colorSet) return;
KoResourceServer<KoColorSet>* srv = KoResourceServerProvider::instance()->paletteServer();
......
......@@ -59,8 +59,8 @@ public:
* Sets the color set that this widget shows.
* @param colorSet pointer to the color set
*/
void setColorSet(KoColorSet *colorSet);
void setColorSet(QPointer<KoColorSet> colorSet);
/**
* @brief setDisplayRenderer
* Set the display renderer of this object.
......
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