mirror of
https://github.com/huderlem/porymap.git
synced 2026-06-21 15:19:46 -05:00
Fix crash when switching projects with the Shortcuts Editor open
This commit is contained in:
parent
8dba5c24a2
commit
83db36f6eb
|
|
@ -3111,9 +3111,11 @@ bool MainWindow::closeSupplementaryWindows() {
|
|||
|
||||
// Attempt to close any visible windows (excluding the main window), giving each a chance to abort the process.
|
||||
for (const auto &widget : QApplication::topLevelWidgets()) {
|
||||
if (widget != this && widget->isWindow() && widget->isVisible()) {
|
||||
if (widget != this && widget->isWindow()) {
|
||||
// Make sure the window is raised and activated before closing in case it has a confirmation prompt.
|
||||
openSubWindow(widget);
|
||||
if (widget->isVisible()) {
|
||||
openSubWindow(widget);
|
||||
}
|
||||
if (!widget->close()) {
|
||||
QString message = QStringLiteral("Aborted project close");
|
||||
if (widget && !widget->objectName().isEmpty()) {
|
||||
|
|
@ -3132,12 +3134,12 @@ bool MainWindow::closeSupplementaryWindows() {
|
|||
}
|
||||
|
||||
bool MainWindow::closeProject() {
|
||||
if (!closeSupplementaryWindows())
|
||||
return false;
|
||||
|
||||
if (!isProjectOpen())
|
||||
return true;
|
||||
|
||||
if (!closeSupplementaryWindows())
|
||||
return false;
|
||||
|
||||
if (this->editor->project->hasUnsavedChanges()) {
|
||||
auto reply = SaveChangesMessage::show(QStringLiteral("The project"), this);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user