From 401e6277eb4be6b36df5bf874a9576be687ce720 Mon Sep 17 00:00:00 2001 From: Yurii Puchkov Date: Thu, 20 May 2021 22:39:39 +0300 Subject: [PATCH] NC/fix - App crashes (one more fix for the same issue) (#1632) * fix - App crashes if during editing text add any object (one more fix for the same issue) (cherry picked from commit 08a3b01929ac01de26a25883f3acded6a29c500b) * fix - Upload doesn't called (active tool is not set on processTool) (cherry picked from commit d914b2ba7ba4d1741f6e990587d13a5d08b0c591) * fix - crash on draw (rollback optimisation) (cherry picked from commit 2769c45eac69c6a36284a4d5a16ca2c49262d158) Co-authored-by: Yuriy Puchkov --- src/widgets/capture/capturewidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 07cd4e5f..e4b8ed3a 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -309,15 +309,14 @@ void CaptureWidget::releaseActiveTool() { if (m_activeTool) { if (m_activeTool->editMode()) { + // Object shouldn't be deleted here because it is in the undo/redo + // stack, just set current pointer to null m_activeTool->setEditMode(false); if (m_activeTool->isChanged()) { pushObjectsStateToUndoStack(); } - } - if (-1 == m_panel->activeLayerIndex() && m_activeButton) { - // delete tool if no active selection, otherwise object shouldn't be - // deleted, because it is in undo/redo stack - m_activeTool->deleteLater(); + } else { + delete m_activeTool; } m_activeTool = nullptr; }