diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-03-07 10:49:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-08 00:21:53 +0100 |
commit | 8fdd11465cd17006a108a6f04b2fb1bf8fc5de2f (patch) | |
tree | 28a56cd6dc34a6592716338fc0959785a71fe387 /src/widgets/kernel/qwidget_qpa.cpp | |
parent | be81c5884549c3b97ade6e7b97cf75a076d70424 (diff) |
Destroy backingstore before window
The window is created before the backingstore, so the destruction should
happen in the reverse order. Also, the backingstore is created based on
a pointer to a QWindow, so the dependency is from backingstore to window.
Thirdly, this fixes a crash when using QQuickWidget/QOpenGLWidget.
Task-number: QTBUG-37045
Change-Id: I6e782c553fddfeef877be30ca2610aff75a425a0
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 174b7eb5d5..5885673591 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -939,6 +939,12 @@ void QWidgetPrivate::createTLSysExtra() void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { + //the qplatformbackingstore may hold a reference to the window, so the backingstore + //needs to be deleted first + extra->topextra->backingStoreTracker.destroy(); + delete extra->topextra->backingStore; + extra->topextra->backingStore = 0; + //the toplevel might have a context with a "qglcontext associated with it. We need to //delete the qglcontext before we delete the qplatformopenglcontext. //One unfortunate thing about this is that we potentially create a glContext just to @@ -950,10 +956,6 @@ void QWidgetPrivate::deleteTLSysExtra() delete extra->topextra->window; extra->topextra->window = 0; - extra->topextra->backingStoreTracker.destroy(); - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; - #ifndef QT_NO_OPENGL delete extra->topextra->shareContext; extra->topextra->shareContext = 0; |