From 0fdc1a71f02933778e94125f913b6f5f9a2427ea Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 25 Feb 2014 13:52:19 +0100 Subject: [PATCH] don't double create root objects --- src/plasmaquick/appletquickitem.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp index a0dbf5ed2..49b825c01 100644 --- a/src/plasmaquick/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -183,7 +183,7 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem() return fullRepresentationItem.data(); } - if (fullRepresentation) { + if (fullRepresentation && fullRepresentation.data() != qmlObject->mainComponent()) { fullRepresentationItem = qmlObject->createObjectFromComponent(fullRepresentation.data(), QtQml::qmlContext(qmlObject->rootObject())); } else { fullRepresentation = qmlObject->mainComponent(); @@ -191,6 +191,11 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem() emit q->fullRepresentationChanged(fullRepresentation.data()); } + + if (!fullRepresentationItem) { + return 0; + } + QQuickItem *graphicsObj = qobject_cast(fullRepresentationItem.data()); QObject::connect (graphicsObj, &QQuickItem::widthChanged, [=]() { fullRepresentationResizeTimer.start(); @@ -435,7 +440,7 @@ Plasma::Applet *AppletQuickItem::applet() const void AppletQuickItem::init() { - if (AppletQuickItemPrivate::s_rootObjects.contains(this)) { + if (AppletQuickItemPrivate::s_rootObjects.contains(d->qmlObject->engine())) { return; }