diff options
author | Michael Brasser <mbrasser@ford.com> | 2017-11-21 12:18:56 -0600 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-11-28 14:26:22 +0000 |
commit | cc46992fbb94f1775ac22aa23b42d76f810a5913 (patch) | |
tree | 1cd305e40235b6d114e3e65b74211ce0890e35ca /src/qml/qml/qqmlmetatype.cpp | |
parent | 19f54245d35ee5eb66b991274908f780b103e3b4 (diff) |
Fix issue with circular singleton instantiationsv5.10.0-rc2
While a recursion check exists and works, it can lead to instanting
the same singleton multiple times (leaking all but one copy).
Change-Id: Icf342aad71c5cb225488262341517d95786e1f84
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 8e6be538ef..0f388cf7b7 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -274,8 +274,10 @@ void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) QQmlData::ensurePropertyCache(e, o); } else if (!url.isEmpty() && !qobjectApi(e)) { QQmlComponent component(e, url, QQmlComponent::PreferSynchronous); - QObject *o = component.create(); + QObject *o = component.beginCreate(e->rootContext()); setQObjectApi(e, o); + if (o) + component.completeCreate(); } v4->popContext(); } |