Skip to content

Keep Qt's own message dialogs on Plasma (fixes SIGSEGV in ~QMessageBox) - #69

Open
wehrwolfmann wants to merge 1 commit into
CachyOS:developfrom
wehrwolfmann:crash-native-message-dialog
Open

Keep Qt's own message dialogs on Plasma (fixes SIGSEGV in ~QMessageBox)#69
wehrwolfmann wants to merge 1 commit into
CachyOS:developfrom
wehrwolfmann:crash-native-message-dialog

Conversation

@wehrwolfmann

Copy link
Copy Markdown

Fixes #68 — the analysis and the core-dump frames are there.

Short version: on Plasma KDEPlatformMessageDialogHelper creates its own QMessageBox, sets Qt::WA_DeleteOnClose on it and keeps a raw pointer. QDialog::exec() deletes that dialog when it closes, so the helper is left with a dangling pointer, and the hide() call from ~QMessageBox walks into freed memory.

The real defect is in plasma-integration and I am reporting it there as well, but every QMessageBox in this app is exposed to it, so this one line keeps Qt's own dialogs. Nothing changes visually — the "native" Plasma dialog is a QMessageBox too.

Measured: with the patch, 10 About/License cycles under a debugger produce zero helper dialogs and zero setNativeDialogVisible calls, app alive. Without it the helper dialog is created and destroyed before the app's own box on every single About click.

On Plasma our message boxes go through KDEPlatformMessageDialogHelper. It
creates its own QMessageBox, sets Qt::WA_DeleteOnClose on it and keeps a raw
pointer to it. QDialog::exec() deletes that dialog when it closes, so the
helper is left with a dangling pointer; the later hide() call from
~QMessageBox dereferences freed memory and kills the app with SIGSEGV.

The defect is in plasma-integration, but every QMessageBox in the app is
exposed to it, so keep Qt's own dialogs instead. Nothing changes visually -
the "native" Plasma dialog is a QMessageBox as well.

Measured with the patch: 10 About/License cycles under a debugger, zero
helper dialogs created and zero setNativeDialogVisible calls. Without it the
helper dialog is created and destroyed before our own box on every click.
@wehrwolfmann
wehrwolfmann force-pushed the crash-native-message-dialog branch from 4eb0adb to 39ac19f Compare August 22, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIGSEGV in ~QMessageBox on Plasma - native message dialog helper is used after free

1 participant