From 64ce6e25e5352cda0485e692d8636d7844528b9c Mon Sep 17 00:00:00 2001 From: Rodney Date: Feb 10 2022 09:44:41 +0000 Subject: Merge pull request #4252 from shun-iwasawa/fix_crash_on_undoing_tool Fix crash on undoing tool --- diff --git a/toonz/sources/include/tools/toolutils.h b/toonz/sources/include/tools/toolutils.h index 9dc2736..9bccc00 100644 --- a/toonz/sources/include/tools/toolutils.h +++ b/toonz/sources/include/tools/toolutils.h @@ -182,6 +182,8 @@ public: .arg(QString::fromStdWString(m_level->getName())) .arg(QString::number(m_frameId.getNumber())); } + + void onAdd() override; }; //================================================================================================ diff --git a/toonz/sources/tnztools/toolutils.cpp b/toonz/sources/tnztools/toolutils.cpp index 6038269..b562ba8 100644 --- a/toonz/sources/tnztools/toolutils.cpp +++ b/toonz/sources/tnztools/toolutils.cpp @@ -603,6 +603,17 @@ void ToolUtils::TToolUndo::notifyImageChanged() const { } } +//------------------------------------------------------------------------------------------ + +void ToolUtils::TToolUndo::onAdd() { + // clean up the flags after registering undo + TTool::m_isLevelCreated = false; + TTool::m_isFrameCreated = false; + TTool::m_isLevelRenumbererd = false; +} + +//------------------------------------------------------------------------------------------ + int ToolUtils::TToolUndo::m_idCount = 0; //================================================================================================