OpenToonz - An open-source full-featured 2D animation creation software
C
Fix crash on arrows using eraser (#1221)
Jeremy Bullock60023a892f26
diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cppindex 18d75023a..dd33bc635 100644--- a/toonz/sources/tnztools/vectorerasertool.cpp+++ b/toonz/sources/tnztools/vectorerasertool.cpp@@ -319,7 +319,7 @@ private:TStroke *m_stroke; //!< Stores the stroke generated by m_track.TStroke*m_firstStroke; //!< Stores the first stroke in the "frame range" case.-+ TImageP m_activeImage = NULL; // needed if an frame is changed mid-erasedouble m_thick;bool m_firstTime, m_active, m_firstFrameSelected;@@ -769,7 +769,8 @@ void EraserTool::stopErase(TVectorImageP vi) {if (m_indexes[i] == -1) m_undo->addNewStroke(i, vi->getVIStroke(i));}TUndoManager::manager()->add(m_undo);- m_undo = 0;+ m_undo = 0;+ m_active = false;invalidate();notifyImageChanged();}@@ -782,6 +783,7 @@ void EraserTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {m_active = true;TImageP image(getImage(true));+ m_activeImage = image;if (m_eraseType.getValue() == NORMAL_ERASE) {if (TVectorImageP vi = image) startErase(vi, pos /*,imageLocation*/);} else if (m_eraseType.getValue() == RECT_ERASE) {@@ -875,6 +877,9 @@ void EraserTool::multiEraseRect(TFrameId firstFrameId, TFrameId lastFrameId,//-----------------------------------------------------------------------------void EraserTool::onImageChanged() {+ if (m_active) {+ stopErase(m_activeImage);+ }if (!m_multi.getValue()) return;TTool::Application *application = TTool::getApplication();if (!application) return;@@ -1399,7 +1404,7 @@ void EraserTool::multiEreserRegion(TStroke *stroke, const TMouseEvent &e) {}//------------------------------------------------------------------------------/*! ドラッグ中にツールが切り替わった場合、Erase終了処理を行う+/*! When the tool is switched during dragging, Erase end processing is performed*/void EraserTool::onDeactivate() {if (!m_active) return;