Skip to content

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

C

fix crash on replacing level:

shun-iwasawa08548b38a4e8
diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cpp
index e222b8efa..87ef32efb 100644
--- a/toonz/sources/toonz/levelsettingspopup.cpp
+++ b/toonz/sources/toonz/levelsettingspopup.cpp
@@ -747,7 +747,7 @@ LevelSettingsValues LevelSettingsPopup::getValues(TXshLevelP level) {
values.doAntialias = (sl->getProperties()->antialiasSoftness() > 0)
? Qt::Checked
: Qt::Unchecked;
- values.softness = sl->getProperties()->antialiasSoftness();
+ values.softness = sl->getProperties()->antialiasSoftness();
}
}
@@ -1438,6 +1438,7 @@ void LevelSettingsPopup::onSubsamplingChanged() {
return;
}
+ bool somethingChanged = false;
TUndoManager::manager()->beginBlock();
QSetIterator<TXshLevelP> levelItr(m_selectedLevels);
while (levelItr.hasNext()) {
@@ -1454,8 +1455,10 @@ void LevelSettingsPopup::onSubsamplingChanged() {
TUndoManager::manager()->add(new LevelSettingsUndo(
levelP.getPointer(), LevelSettingsUndo::Subsampling, oldSubsampling,
subsampling));
+ somethingChanged = true;
}
TUndoManager::manager()->endBlock();
+ if (!somethingChanged) return;
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
TApp::instance()
diff --git a/toonz/sources/toonz/previewfxmanager.cpp b/toonz/sources/toonz/previewfxmanager.cpp
index ccffbfbcc..169204a07 100644
--- a/toonz/sources/toonz/previewfxmanager.cpp
+++ b/toonz/sources/toonz/previewfxmanager.cpp
@@ -1456,6 +1456,7 @@ void PreviewFxManager::onLevelChanged() {
// Build the level name as an alias keyword. All cache images associated
// with an alias containing the level name will be updated.
TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel();
+ if (!xl) return;
std::string aliasKeyword;
TFilePath fp = xl->getPath();
aliasKeyword = ::to_string(fp.withType(""));