Skip to content

V4: Do not call dtor of an object we continue to use

After destroyObject(), the QObjectWrapper is still alive. We might use its heap object again. Furthermore, the Heap::QObjectWrapper dtor does not actually do anything defined. What we want to do here is clear the QObject pointer because we've just gotten rid of the QObject. There is a method for that: Heap::QObjectWrapper::destroy().

Finally, the internalClass must never ever be nullptr. Assert on that rather than checking it.

Pick-to: 5.15 6.2 6.3

Task-number: QTBUG-100431

Change-Id: I794a295c182b2ed4ba80673f58d6143c861b7391

Reviewed-by: Andrei Golubev

Reviewed-by: Qt CI Bot

Reviewed-by: Fabian Kosmale

(cherry picked from commit 6c197319)

Merge request reports