Fix crash with open windows when switching projects
This commit is contained in:
parent
e9210f96aa
commit
c28730e834
2 changed files with 13 additions and 0 deletions
|
@ -216,6 +216,7 @@ private:
|
|||
bool openRecentProject();
|
||||
void updateTilesetEditor();
|
||||
QString getEventGroupFromTabWidget(QWidget *tab);
|
||||
void closeSupplementaryWindows();
|
||||
|
||||
bool isProjectOpen();
|
||||
};
|
||||
|
|
|
@ -293,6 +293,7 @@ bool MainWindow::openProject(QString dir) {
|
|||
projectConfig.setProjectDir(dir);
|
||||
projectConfig.load();
|
||||
|
||||
this->closeSupplementaryWindows();
|
||||
this->setProjectSpecificUIVisibility();
|
||||
|
||||
bool already_open = isProjectOpen() && (editor->project->root == dir);
|
||||
|
@ -2410,6 +2411,17 @@ void MainWindow::on_actionRegion_Map_Editor_triggered() {
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeSupplementaryWindows() {
|
||||
if (this->tilesetEditor)
|
||||
delete this->tilesetEditor;
|
||||
if (this->regionMapEditor)
|
||||
delete this->regionMapEditor;
|
||||
if (this->mapImageExporter)
|
||||
delete this->mapImageExporter;
|
||||
if (this->newmapprompt)
|
||||
delete this->newmapprompt;
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
if (projectHasUnsavedChanges || editor->map->hasUnsavedChanges()) {
|
||||
QMessageBox::StandardButton result = QMessageBox::question(
|
||||
|
|
Loading…
Reference in a new issue