mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 21:34:12 +02:00
ce890da342
QETApp::receiveMessage() called openFiles() directly. That slot runs inside SingleApplication's socket handling: SingleApplicationPrivate:: slotDataAvailable() emits receivedMessage synchronously from the readyRead lambda (singleapplication_p.cpp:452). openFiles() then loads a project -- seconds of work on a large one -- and openAndAddProject() puts up a modal BackupDialog whose exec() runs a nested event loop while the socket handler is still on the stack. During that nested loop the secondary instance exits, the connection closes and the QLocalSocket is deleted. When the dialog is dismissed and the stack unwinds, QMetaObject::activate() carries on emitting on the freed sender and the process dies. A zero-timer returns to the event loop first, so the socket stack is fully unwound before any project is opened. Found by scorpio810 while testing PR #861, with a backtrace showing no QET frame above the crash. His second suggestion, looking for a delete that should be deleteLater(), turned out to be already satisfied at singleapplication_p.cpp:331 -- which is why the deferred delete is not enough on its own once a nested loop is in play. Dismissing the dialog is the step that makes it fail: two earlier attempts to reproduce it left the dialog open, the stack never unwound, and nothing crashed. With the dialog dismissed it segfaults twice out of two; with this change it survives twice out of two, opens the project as before, and ctest stays green. Qt 6.10.2 on X11/xcb -- also checked under a headless Wayland compositor and under Qt 5.15.18, so it is neither Wayland-specific nor a Qt6 regression. The crash needs PR #861 to be reachable at all: without it splitWithSpaces() returns an empty list, no project opens, and nothing enters this path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>