From 5cc2e165bfe1a203997098b966910047dab833ad Mon Sep 17 00:00:00 2001 From: Shane Ringrose Date: Mon, 22 Jun 2026 17:30:20 +1200 Subject: [PATCH 1/2] Fix #527: use ApplicationModal for Project Properties to prevent SIGSEGV MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProjectPropertiesDialog::exec() was using Qt::WindowModal, which only blocks the parent ProjectView window. The MDI workspace and its other subwindows remained interactive, so actions like new_project or close_project could fire while the dialog's config pages still held raw QETProject* pointers — leading to a SIGSEGV when Qt's event loop later dispatched a signal through one of those stale pointers. Detected by the 8-hour GUI fuzzer: action sequence add_diagram_page → flood_wires ×18 → new_project while Project Properties was open produced exit code -11 (SIGSEGV) on the first of 12,717 actions. Switch to Qt::ApplicationModal so no window can receive input while the dialog is open. Project Properties is a short-lived dialog; blocking the whole application for its duration matches user expectation and removes the lifetime hazard without requiring QPointer surgery across four config-page classes. Co-Authored-By: Claude Sonnet 4.6 --- sources/ui/projectpropertiesdialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index f393c7ea4..b9bea1c71 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -63,7 +63,13 @@ ProjectPropertiesDialog::~ProjectPropertiesDialog () */ void ProjectPropertiesDialog::exec() { - m_properties_dialog->setWindowModality(Qt::WindowModal); + // ApplicationModal (not WindowModal) so no other window — including other + // MDI subwindows — can dispatch events while the dialog holds raw + // QETProject* pointers in its config pages. WindowModal only blocks the + // parent ProjectView; the rest of the MDI area stays live, which allowed + // new_project / close_project to replace the project under the dialog + // and cause a SIGSEGV. See issue #527. + m_properties_dialog->setWindowModality(Qt::ApplicationModal); m_properties_dialog -> exec(); } From bab32b3764c3bb89c2d90cbd2e363915769b2cf7 Mon Sep 17 00:00:00 2001 From: Shane Ringrose Date: Mon, 22 Jun 2026 17:48:19 +1200 Subject: [PATCH 2/2] Fix #527 follow-up: use ApplicationModal for app config dialog (configureQET) Same root cause as ProjectPropertiesDialog: Qt::WindowModal only blocks the direct parent window, leaving the rest of the MDI area live. If new_project or close_project fires while the app settings dialog is open, any raw pointers derived from the project list become stale. Switch to ApplicationModal to block all windows for the duration of the dialog. Co-Authored-By: Claude Sonnet 4.6 --- sources/qetapp.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index aaa462fc5..ef561dabd 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1969,7 +1969,10 @@ void QETApp::configureQET() // cree le dialogue ConfigDialog cd; cd.setWindowTitle(tr("Configurer QElectroTech", "window title")); - cd.setWindowModality(Qt::WindowModal); + // ApplicationModal so no other window can dispatch events while the dialog + // holds raw pointers derived from the current project list. Same class of + // bug as ProjectPropertiesDialog — see issue #527. + cd.setWindowModality(Qt::ApplicationModal); cd.addPage(new GeneralConfigurationPage()); cd.addPage(new NewDiagramPage()); cd.addPage(new ExportConfigPage());