Commit 78ea95b5 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix crash when Colorize Tool is active on closing Krita

Steps to reproduce:
1) Create a layer with colorize mask
2) Disable "Show key strokes" on the mask (important)
3) Select "Colorize Tool"
4) Click on the mask, to lazily activate key strokes
5) Close Krita -> Crash

The crash happened because of some weird update signals coming
after KisView was actually destroyed.
parent 3def70fa
...@@ -311,6 +311,8 @@ void TimelineFramesModel::slotImageContentChanged() ...@@ -311,6 +311,8 @@ void TimelineFramesModel::slotImageContentChanged()
void TimelineFramesModel::processUpdateQueue() void TimelineFramesModel::processUpdateQueue()
{ {
if (!m_d->converter) return;
Q_FOREACH (KisNodeDummy *dummy, m_d->updateQueue) { Q_FOREACH (KisNodeDummy *dummy, m_d->updateQueue) {
int row = m_d->converter->rowForDummy(dummy); int row = m_d->converter->rowForDummy(dummy);
......
...@@ -253,7 +253,7 @@ void KisUndoModel::addImage(int idx) ...@@ -253,7 +253,7 @@ void KisUndoModel::addImage(int idx)
const KUndo2Command* currentCommand = m_stack->command(idx-1); const KUndo2Command* currentCommand = m_stack->command(idx-1);
if (m_stack->count() == idx && !m_imageMap.contains(currentCommand)) { if (m_stack->count() == idx && !m_imageMap.contains(currentCommand)) {
KisImageWSP historyImage = m_canvas->viewManager()->image(); KisImageWSP historyImage = m_canvas->image();
KisPaintDeviceSP paintDevice = historyImage->projection(); KisPaintDeviceSP paintDevice = historyImage->projection();
QImage image = paintDevice->createThumbnail(32, 32, 1, QImage image = paintDevice->createThumbnail(32, 32, 1,
KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalRenderingIntent(),
......
...@@ -49,7 +49,7 @@ struct KisToolLazyBrush::Private ...@@ -49,7 +49,7 @@ struct KisToolLazyBrush::Private
bool oldShowKeyStrokesValue = false; bool oldShowKeyStrokesValue = false;
bool oldShowColoringValue = false; bool oldShowColoringValue = false;
KisNodeSP manuallyActivatedNode; KisNodeWSP manuallyActivatedNode;
KisSignalAutoConnectionsStore toolConnections; KisSignalAutoConnectionsStore toolConnections;
}; };
...@@ -69,10 +69,15 @@ KisToolLazyBrush::~KisToolLazyBrush() ...@@ -69,10 +69,15 @@ KisToolLazyBrush::~KisToolLazyBrush()
void KisToolLazyBrush::tryDisableKeyStrokesOnMask() void KisToolLazyBrush::tryDisableKeyStrokesOnMask()
{ {
if (m_d->manuallyActivatedNode) { // upgrade to strong pointer
KisLayerPropertiesIcons::setNodeProperty(m_d->manuallyActivatedNode, KisLayerPropertiesIcons::colorizeEditKeyStrokes, false, image()); KisNodeSP manuallyActivatedNode = m_d->manuallyActivatedNode;
m_d->manuallyActivatedNode = 0;
if (manuallyActivatedNode) {
KisLayerPropertiesIcons::setNodeProperty(manuallyActivatedNode, KisLayerPropertiesIcons::colorizeEditKeyStrokes, false, image());
manuallyActivatedNode = 0;
} }
m_d->manuallyActivatedNode = 0;
} }
...@@ -101,7 +106,10 @@ void KisToolLazyBrush::deactivate() ...@@ -101,7 +106,10 @@ void KisToolLazyBrush::deactivate()
void KisToolLazyBrush::slotCurrentNodeChanged(KisNodeSP node) void KisToolLazyBrush::slotCurrentNodeChanged(KisNodeSP node)
{ {
if (node != m_d->manuallyActivatedNode) { // upgrade to strong pointer
KisNodeSP manuallyActivatedNode = m_d->manuallyActivatedNode;
if (node != manuallyActivatedNode) {
tryDisableKeyStrokesOnMask(); tryDisableKeyStrokesOnMask();
KisColorizeMask *mask = qobject_cast<KisColorizeMask*>(node.data()); KisColorizeMask *mask = qobject_cast<KisColorizeMask*>(node.data());
...@@ -190,10 +198,12 @@ void KisToolLazyBrush::beginPrimaryAction(KoPointerEvent *event) ...@@ -190,10 +198,12 @@ void KisToolLazyBrush::beginPrimaryAction(KoPointerEvent *event)
if (!colorizeMaskActive() && canCreateColorizeMask()) { if (!colorizeMaskActive() && canCreateColorizeMask()) {
tryCreateColorizeMask(); tryCreateColorizeMask();
} else if (shouldActivateKeyStrokes()) { } else if (shouldActivateKeyStrokes()) {
// upgrade to strong pointer
KisNodeSP manuallyActivatedNode = m_d->manuallyActivatedNode;
KisNodeSP node = currentNode(); KisNodeSP node = currentNode();
KIS_SAFE_ASSERT_RECOVER_NOOP(!m_d->manuallyActivatedNode || KIS_SAFE_ASSERT_RECOVER_NOOP(!manuallyActivatedNode ||
m_d->manuallyActivatedNode == node); manuallyActivatedNode == node);
KisLayerPropertiesIcons::setNodeProperty(node, KisLayerPropertiesIcons::setNodeProperty(node,
KisLayerPropertiesIcons::colorizeEditKeyStrokes, KisLayerPropertiesIcons::colorizeEditKeyStrokes,
......
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