diff options
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickrendercontrol.cpp | 19 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol_p.h | 1 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index cc4cec443a..d00b02c005 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -129,11 +129,6 @@ QQuickRenderControlPrivate::QQuickRenderControlPrivate() rc = new QSGRenderContext(sg); } -QQuickRenderControlPrivate::~QQuickRenderControlPrivate() -{ - delete rc; -} - void QQuickRenderControlPrivate::cleanup() { delete sg; @@ -162,13 +157,25 @@ QQuickRenderControl::~QQuickRenderControl() if (d->window) QQuickWindowPrivate::get(d->window)->renderControl = 0; + + // It is likely that the cleanup in windowDestroyed() is not called since + // the standard pattern is to destroy the rendercontrol before the QQuickWindow. + // Do it here. + d->windowDestroyed(); + + delete d->rc; } void QQuickRenderControlPrivate::windowDestroyed() { - if (window == 0) { + if (window) { rc->invalidate(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + + delete QQuickWindowPrivate::get(window)->animationController; + QQuickWindowPrivate::get(window)->animationController = 0; + + window = 0; } } diff --git a/src/quick/items/qquickrendercontrol_p.h b/src/quick/items/qquickrendercontrol_p.h index 8837ed79dc..6fe475bb93 100644 --- a/src/quick/items/qquickrendercontrol_p.h +++ b/src/quick/items/qquickrendercontrol_p.h @@ -56,7 +56,6 @@ public: Q_DECLARE_PUBLIC(QQuickRenderControl) QQuickRenderControlPrivate(); - ~QQuickRenderControlPrivate(); static QQuickRenderControlPrivate *get(QQuickRenderControl *renderControl) { return renderControl->d_func(); |