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

@ -761,7 +761,7 @@ LevelSettingsValues LevelSettingsPopup::getValues(TXshLevelP level) {
values.doAntialias = (sl->getProperties()->antialiasSoftness() > 0) values.doAntialias = (sl->getProperties()->antialiasSoftness() > 0)
? Qt::Checked ? Qt::Checked
: Qt::Unchecked; : Qt::Unchecked;
values.softness = sl->getProperties()->antialiasSoftness(); values.softness = sl->getProperties()->antialiasSoftness();
} }
} }
@ -1475,6 +1475,7 @@ void LevelSettingsPopup::onSubsamplingChanged() {
return; return;
} }
bool somethingChanged = false;
TUndoManager::manager()->beginBlock(); TUndoManager::manager()->beginBlock();
QSetIterator<TXshLevelP> levelItr(m_selectedLevels); QSetIterator<TXshLevelP> levelItr(m_selectedLevels);
while (levelItr.hasNext()) { while (levelItr.hasNext()) {
@ -1491,8 +1492,10 @@ void LevelSettingsPopup::onSubsamplingChanged() {
TUndoManager::manager()->add(new LevelSettingsUndo( TUndoManager::manager()->add(new LevelSettingsUndo(
levelP.getPointer(), LevelSettingsUndo::Subsampling, oldSubsampling, levelP.getPointer(), LevelSettingsUndo::Subsampling, oldSubsampling,
subsampling)); subsampling));
somethingChanged = true;
} }
TUndoManager::manager()->endBlock(); TUndoManager::manager()->endBlock();
if (!somethingChanged) return;
TApp::instance()->getCurrentScene()->setDirtyFlag(true); TApp::instance()->getCurrentScene()->setDirtyFlag(true);
TApp::instance() TApp::instance()

View file

@ -1456,6 +1456,7 @@ void PreviewFxManager::onLevelChanged() {
// Build the level name as an alias keyword. All cache images associated // Build the level name as an alias keyword. All cache images associated
// with an alias containing the level name will be updated. // with an alias containing the level name will be updated.
TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel(); TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel();
if (!xl) return;
std::string aliasKeyword; std::string aliasKeyword;
TFilePath fp = xl->getPath(); TFilePath fp = xl->getPath();
aliasKeyword = ::to_string(fp.withType("")); aliasKeyword = ::to_string(fp.withType(""));