Skip to content

Don't access QObjectPrivate::declarativeData unguarded

Albert Astals Cid requested to merge aacid/qtbase:work/2052 into kde/5.15

The QObjectPrivate::declarativeData member is stored in a union with currentChildBeingDeleted. The QObject destructor always sets the currentChildBeingDeleted member of the union. It also sets the isDeletingChildren bool, which is the only way to find out which union member we can safely access.

While the QObject destructor is deleting children and isDeletingChildren is set, we must not access the declarativeData member of the union.

Add a test case that initializes the function pointers for the declarative handlers and constructs a situation where an object emits a signal while it is destroying children.

Fixes: QTBUG-105286 Pick-to: 6.4 6.3 6.3.2 6.2 5.15 Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02 Reviewed-by: Qt CI Bot qt_ci_bot@qt-project.org Reviewed-by: Mårten Nordheim marten.nordheim@qt.io (cherry picked from commit 3be99799)

Merge request reports