summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-02-05 14:49:46 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-02-06 20:59:44 +0000
commitc6b3c69e014f846a142c2429cd2d675c75b74245 (patch)
tree6d664edc78e55561233137b60ddb498acee5b453
parent5b0a98fa16330f220d3fbf67e9a55c8632d30129 (diff)
Fix memory leak with deferred properties
This is a regression introduced with commit 3b6eeee177b64eebe240d51be0c7bb5f031471d8 in the 5.9 branch. When constructing an object with deferred properties and not running qmlExecuteDeferred, then the deferred data would never get deleted because the bindings list remains non-empty and we would leak the deferred data as well as the entire compilation unit behind it. This happens for example when declaring when instantiating a QML file with states: states: [ State { ... }, State { ... }, ... } Unless every state is entered, its deferred changes property is never applied (via qmlExecuteDeferred) and thus the defer data is leaked. Task-number: QTBUG-66189 Change-Id: I1b2119c601d1e0ab4e37f53d4cf2f569586ee883 Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/qml/qml/qqmlengine.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 7dac0b3c8d..f4656bafd2 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1763,7 +1763,8 @@ void QQmlData::destroyed(QObject *object)
compilationUnit = nullptr;
- releaseDeferredData();
+ qDeleteAll(deferredData);
+ deferredData.clear();
QQmlBoundSignal *signalHandler = signalHandlers;
while (signalHandler) {