Skip to content

use QPointer in QTimer::singleShot to prevent use-after-free#1

Open
zakmat wants to merge 1 commit intojazzyfrom
fix/property-use-after-free-jazzy
Open

use QPointer in QTimer::singleShot to prevent use-after-free#1
zakmat wants to merge 1 commit intojazzyfrom
fix/property-use-after-free-jazzy

Conversation

@zakmat
Copy link
Member

@zakmat zakmat commented Feb 3, 2026

The QTimer::singleShot in Property::setModel used model_ as context but captured 'this' (Property*). If the Property was destroyed before the timer fired, this caused a use-after-free crash in the propertyHiddenChanged signal emission.

Fix by capturing QPointer guarded 'this'. Semantic stays the same - Qt automatically cancels the timer if the model_ is destroyed but QPointer on Property provides extra protection.

The bug manifests as a segfault in MoveIt Setup Assistant when loading robot models, crashing in PropertyTreeModel::propertyHiddenChanged().

Some MoveIt2 crashes seem relevant:

  • 3546
  • 3553
  • 3541

The QTimer::singleShot in Property::setModel used model_ as context
but captured 'this' (Property*). If the Property was destroyed before
the timer fired, this caused a use-after-free crash in the
propertyHiddenChanged signal emission.

Fix by capturing QPointer guarded 'this'. Semantic stays the same - Qt automatically cancels
the timer if the model_ is destroyed but QPointer on Property provides extra protection.

The bug manifests as a segfault in MoveIt Setup Assistant when loading
robot models, crashing in PropertyTreeModel::propertyHiddenChanged().

Some MoveIt2 crashes seem relevant:
- 3546
- 3553
- 3541

Signed-off-by: Mateusz Żak <mateusz.zak@robotec.ai>
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