Commit c4a515a8 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Recreate a default bounds object on every KisMask::setImage() call

Basically, default bounds objects may be shared among multiple objects
so changing it is not safe.

CCBUG:345619
parent 11a38dca
...@@ -47,11 +47,6 @@ KisDefaultBounds::~KisDefaultBounds() ...@@ -47,11 +47,6 @@ KisDefaultBounds::~KisDefaultBounds()
delete m_d; delete m_d;
} }
void KisDefaultBounds::setImage(KisImageWSP image)
{
m_d->image = image;
}
QRect KisDefaultBounds::bounds() const QRect KisDefaultBounds::bounds() const
{ {
/** /**
......
...@@ -37,8 +37,6 @@ public: ...@@ -37,8 +37,6 @@ public:
KisDefaultBounds(KisImageWSP image = 0); KisDefaultBounds(KisImageWSP image = 0);
virtual ~KisDefaultBounds(); virtual ~KisDefaultBounds();
void setImage(KisImageWSP image);
QRect bounds() const; QRect bounds() const;
bool wrapAroundMode() const; bool wrapAroundMode() const;
......
...@@ -95,11 +95,9 @@ KisMask::~KisMask() ...@@ -95,11 +95,9 @@ KisMask::~KisMask()
void KisMask::setImage(KisImageWSP image) void KisMask::setImage(KisImageWSP image)
{ {
KisDefaultBoundsBaseSP db = m_d->selection->pixelSelection()->defaultBounds(); KisPaintDeviceSP parentPaintDevice = parent() ? parent()->original() : 0;
KisDefaultBounds *defaultBounds = dynamic_cast<KisDefaultBounds*>(db.data()); KisDefaultBoundsBaseSP defaultBounds = new KisSelectionDefaultBounds(parentPaintDevice, image);
if (defaultBounds) { m_d->selection->setDefaultBounds(defaultBounds);
defaultBounds->setImage(image);
}
} }
bool KisMask::allowAsChild(KisNodeSP node) const bool KisMask::allowAsChild(KisNodeSP node) const
......
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