aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickview.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-05-24 08:55:39 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-24 01:12:44 +0200
commitf9f00b3fb64809b7bc52e220a995536e0bd91af6 (patch)
tree04f35d5630257f1f822879ffe9604b97031957bb /src/quick/items/qquickview.cpp
parente574e9adcac1244db5c828575553a63ccbdd28b9 (diff)
Ensure QQuickView's engine outlives the root component
If the engine is destroyed before the root component, assumptions of resource availability are broken. Change-Id: I7fe27ff38ae3c215d58fb8811aff449b6c1f7b5b Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickview.cpp')
-rw-r--r--src/quick/items/qquickview.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index b6b6f41a71..b3fba60fb8 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -81,8 +81,6 @@ QQuickViewPrivate::~QQuickViewPrivate()
{
if (QQmlDebugService::isDebuggingEnabled())
QQmlInspectorService::instance()->removeView(q_func());
-
- delete root;
}
void QQuickViewPrivate::execute()
@@ -215,6 +213,11 @@ QQuickView::QQuickView(QQmlEngine* engine, QWindow *parent, Qt::WindowFlags f)
QQuickView::~QQuickView()
{
+ // Ensure that the component is destroyed before the engine; the engine may
+ // be a child of the QQuickViewPrivate, and will be destroyed by its dtor
+ Q_D(QQuickView);
+ delete d->root;
+ d->root = 0;
}
/*! \property QQuickView::source