Fix crash if swtichSize is adjusted during initial setup
This causes us to create components and items during the initial binding evaluation of the root. Reviewed-by: Marco Martin
This commit is contained in:
parent
05daa3e206
commit
03d406770f
@ -51,6 +51,7 @@ AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickIte
|
|||||||
: q(item),
|
: q(item),
|
||||||
switchWidth(-1),
|
switchWidth(-1),
|
||||||
switchHeight(-1),
|
switchHeight(-1),
|
||||||
|
initComplete(false),
|
||||||
applet(a),
|
applet(a),
|
||||||
expanded(false),
|
expanded(false),
|
||||||
activationTogglesExpanded(false)
|
activationTogglesExpanded(false)
|
||||||
@ -342,6 +343,10 @@ void AppletQuickItemPrivate::preloadForExpansion()
|
|||||||
|
|
||||||
void AppletQuickItemPrivate::compactRepresentationCheck()
|
void AppletQuickItemPrivate::compactRepresentationCheck()
|
||||||
{
|
{
|
||||||
|
if (!initComplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!qmlObject->rootObject()) {
|
if (!qmlObject->rootObject()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -669,6 +674,7 @@ void AppletQuickItem::init()
|
|||||||
d->compactRepresentationExpander->loadUrl(compactExpanderUrl);
|
d->compactRepresentationExpander->loadUrl(compactExpanderUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->initComplete = true;
|
||||||
d->compactRepresentationCheck();
|
d->compactRepresentationCheck();
|
||||||
qmlObject()->engine()->rootContext()->setBaseUrl(qmlObject()->source());
|
qmlObject()->engine()->rootContext()->setBaseUrl(qmlObject()->source());
|
||||||
qmlObject()->engine()->setContextForObject(this, qmlObject()->engine()->rootContext());
|
qmlObject()->engine()->setContextForObject(this, qmlObject()->engine()->rootContext());
|
||||||
|
@ -132,6 +132,7 @@ public:
|
|||||||
|
|
||||||
bool expanded : 1;
|
bool expanded : 1;
|
||||||
bool activationTogglesExpanded : 1;
|
bool activationTogglesExpanded : 1;
|
||||||
|
bool initComplete: 1;
|
||||||
|
|
||||||
static QHash<QObject *, AppletQuickItem *> s_rootObjects;
|
static QHash<QObject *, AppletQuickItem *> s_rootObjects;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user