Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix crash on undoing tool

shun-iwasawa530beff1d9f2
diff --git a/toonz/sources/include/tools/toolutils.h b/toonz/sources/include/tools/toolutils.h
index 9dc27363e..9bccc0047 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 603826958..b562ba853 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;
//================================================================================================