From 4fc0df58b8458052a818e3e970a97457882808e6 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 24 Feb 2012 13:33:59 +1000 Subject: [PATCH] Force to send defer deletion events before deleting QQuickCanvas Also change the assert in QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate() to a warning message. Change-Id: Ic1fb7e0b7ffe4a54458a0f3a65127b1afd6dda53 Reviewed-by: Michael Brasser --- src/declarative/qml/qdeclarativeengine.cpp | 3 ++- src/quick/items/qquickcanvas.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 2031bc4..dca0ef2 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -355,7 +355,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate() { - Q_ASSERT(inProgressCreations == 0); + if (inProgressCreations) + qWarning() << QDeclarativeEngine::tr("There are still \"%1\" items in the process of being created at engine destruction.").arg(inProgressCreations); while (cleanup) { QDeclarativeCleanup *c = cleanup; diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index a9df484..6b0eb5b 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -746,6 +746,7 @@ QQuickCanvas::~QQuickCanvas() QQuickItemPrivate *rootItemPrivate = QQuickItemPrivate::get(d->rootItem); rootItemPrivate->removeFromDirtyList(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); delete d->incubationController; d->incubationController = 0; delete d->rootItem; d->rootItem = 0; -- 1.7.2.5