Skip to content

Avoid crash from dangling action pointers in ActionManager#4551

Open
bjorn wants to merge 2 commits into
masterfrom
fix-action-dangling-pointer
Open

Avoid crash from dangling action pointers in ActionManager#4551
bjorn wants to merge 2 commits into
masterfrom
fix-action-dangling-pointer

Conversation

@bjorn

@bjorn bjorn commented Jun 23, 2026

Copy link
Copy Markdown
Member

ActionManager stores raw QAction pointers in mIdToActions and only removed them when unregisterAction() was called explicitly. An action destroyed without being unregistered therefore left a dangling pointer behind, which ActionsModel::refreshConflicts() would later dereference (via findAction()), crashing when opening the Preferences dialog.

The exact trigger of the reported crashes is unknown. All built-in actions should live until the application exits and scripted actions should already have been calling unregisterAction as appropriate. Tracking destruction of the QAction instance makes the code less fragile and will hopefully avoid this kind of crash.

This fixes a crash that was reported on Sentry.

ActionManager stores raw QAction pointers in mIdToActions and only
removed them when unregisterAction() was called explicitly. An action
destroyed without being unregistered therefore left a dangling pointer
behind, which ActionsModel::refreshConflicts() would later dereference
(via findAction()), crashing when opening the Preferences dialog.

The exact trigger of the reported crashes is unknown. All built-in
actions should live until the application exits and scripted actions
should already have been calling unregisterAction as appropriate.
Tracking destruction of the QAction instance makes the code less fragile
and will hopefully avoid this kind of crash.

This fixes a crash that was reported on Sentry.
@bjorn bjorn force-pushed the fix-action-dangling-pointer branch from 9153b96 to 84ccb63 Compare June 23, 2026 14:01
Since it's going to be re-assigned just afterwards anyway.
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.

1 participant