fix crash on switching scenes while selecting raster level frame
This commit is contained in:
parent
ed876b10cc
commit
0f2f032bbb
1 changed files with 9 additions and 1 deletions
|
@ -1319,6 +1319,10 @@ void IoCmd::newScene() {
|
||||||
|
|
||||||
if (!saveSceneIfNeeded(QApplication::tr("New Scene"))) return;
|
if (!saveSceneIfNeeded(QApplication::tr("New Scene"))) return;
|
||||||
|
|
||||||
|
// temporary clear the current level to prevent UI to access deleted level
|
||||||
|
// while switching scenes
|
||||||
|
app->getCurrentLevel()->setLevel(nullptr);
|
||||||
|
|
||||||
IconGenerator::instance()->clearRequests();
|
IconGenerator::instance()->clearRequests();
|
||||||
IconGenerator::instance()->clearSceneIcons();
|
IconGenerator::instance()->clearSceneIcons();
|
||||||
ImageManager::instance()->clear();
|
ImageManager::instance()->clear();
|
||||||
|
@ -1921,6 +1925,11 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
|
||||||
}
|
}
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
|
TApp *app = TApp::instance();
|
||||||
|
// temporary clear the current level to prevent UI to access deleted level
|
||||||
|
// while switching scenes
|
||||||
|
app->getCurrentLevel()->setLevel(nullptr);
|
||||||
|
|
||||||
TUndoManager::manager()->reset();
|
TUndoManager::manager()->reset();
|
||||||
IconGenerator::instance()->clearRequests();
|
IconGenerator::instance()->clearRequests();
|
||||||
IconGenerator::instance()->clearSceneIcons();
|
IconGenerator::instance()->clearSceneIcons();
|
||||||
|
@ -1976,7 +1985,6 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
|
||||||
project->setFolder("project", scenePath);
|
project->setFolder("project", scenePath);
|
||||||
scene->setProject(project);
|
scene->setProject(project);
|
||||||
}
|
}
|
||||||
TApp *app = TApp::instance();
|
|
||||||
app->getCurrentScene()->setScene(scene);
|
app->getCurrentScene()->setScene(scene);
|
||||||
app->getCurrentScene()->notifyNameSceneChange();
|
app->getCurrentScene()->notifyNameSceneChange();
|
||||||
app->getCurrentFrame()->setFrame(0);
|
app->getCurrentFrame()->setFrame(0);
|
||||||
|
|
Loading…
Reference in a new issue