diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2017-02-28 15:39:25 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals@canonical.com> | 2017-03-01 10:05:25 +0000 |
commit | 59c94123e3661274d14f69c3df71fae9325b7eea (patch) | |
tree | 27b0fb3ece615eaa947863689de955c78b286691 /src/qml/types/qqmldelegatemodel.cpp | |
parent | 55fec6b2db17db43fc7d03ef5d482cc67b16543b (diff) |
Fix memory leak in QQDMIncubationTask::statusChanged
Mimic the same process we do in QQmlDelegateModelPrivate::incubatorStatusChanged
i.e. there's no need to check for object before destroying contextData
Change-Id: I8cb1cda6da43bada350183ae11ee9b85b7fffee5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types/qqmldelegatemodel.cpp')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index a5878dcffd..34bc266cb5 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -837,10 +837,9 @@ void QQDMIncubationTask::statusChanged(Status status) } else if (isDoneIncubating(status)) { Q_ASSERT(incubating); // The model was deleted from under our feet, cleanup ourselves - if (incubating->object) { - delete incubating->object; - - incubating->object = 0; + delete incubating->object; + incubating->object = 0; + if (incubating->contextData) { incubating->contextData->destroy(); incubating->contextData = 0; } |