Commit e78752f3 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix crash when transform local selections

BUG:261033
parent 7448b532
......@@ -155,9 +155,9 @@ KisSelectionSP KisMask::selection() const
else {
m_d->selection = new KisSelection();
}
m_d->selection->setParentNode(const_cast<KisMask*>(this));
m_d->selection->updateProjection();
}
m_d->selection->setParentNode(const_cast<KisMask*>(this));
return m_d->selection;
}
......
......@@ -29,14 +29,21 @@ KisSelectedTransactionData::KisSelectedTransactionData(const QString& name, KisN
, m_selTransaction(0)
, m_hadSelection(false)
{
m_layer = dynamic_cast<KisLayer*>(node.data());
while (!m_layer && node->parent()) {
m_layer = dynamic_cast<KisLayer*>(node->parent().data());
node = node->parent();
}
KisNodeSP currentNode = node;
do {
m_layer = dynamic_cast<KisLayer*>(currentNode.data());
} while(!m_layer && (currentNode = currentNode->parent()));
if (m_layer->selection())
m_selTransaction = new KisTransactionData(name, KisPaintDeviceSP(m_layer->selection()->getOrCreatePixelSelection().data()));
KisSelectionSP selection = m_layer->selection();
if(selection) {
KisPaintDeviceSP selectionPaintDevice =
selection->getOrCreatePixelSelection();
if(selectionPaintDevice != node->paintDevice()) {
m_selTransaction = new KisTransactionData(name, selectionPaintDevice);
}
}
}
KisSelectedTransactionData::~KisSelectedTransactionData()
......
......@@ -2141,7 +2141,7 @@ void KisToolTransform::applyTransform()
// Perform the transform. Since we copied the original state back, this doesn't degrade
// after many tweaks. Since we started the transaction before the copy back, the memento
// has the previous state.
if (m_origSelection) {
if (!currentNode()->inherits("KisMask") && m_origSelection) {
KoUpdaterPtr copyPixels = updater->startSubtask(5);
KoUpdaterPtr transformPixels = updater->startSubtask(10);
KoUpdaterPtr copyBackPixels = updater->startSubtask(5);
......
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