fix crash on replacing level:

This commit is contained in:
shun-iwasawa 2022-08-23 15:39:52 +09:00 committed by manongjohn
parent 4494f1077f
commit 2123ba0241
2 changed files with 5 additions and 1 deletions

View file

@ -1475,6 +1475,7 @@ void LevelSettingsPopup::onSubsamplingChanged() {
return;
}
bool somethingChanged = false;
TUndoManager::manager()->beginBlock();
QSetIterator<TXshLevelP> levelItr(m_selectedLevels);
while (levelItr.hasNext()) {
@ -1491,8 +1492,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()

View file

@ -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(""));