mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-14 21:07:44 -05:00
Fix crash with open windows when switching projects
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user