Skip to content

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

C

Fix crash writing edit frame range temp files

John Danceld73b1593ac94
diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp
index c1c5a31ff..cee40530a 100644
--- a/toonz/sources/toonzlib/txshsimplelevel.cpp
+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp
@@ -1432,6 +1432,8 @@ void TXshSimpleLevel::save(const TFilePath &fp, const TFilePath &oldFp,
sl->setPath(getScene()->codeFilePath(app));
sl->setType(getType());
sl->setDirtyFlag(getDirtyFlag());
+ sl->addRef(); // Needed so levelUpdater doesn't destroy it right away
+ // when its done writing
std::set<TFrameId>::iterator eft, efEnd = m_editableRange.end();
for (eft = m_editableRange.begin(); eft != efEnd; ++eft) {