diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-03-11 12:23:29 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 13:27:36 +0100 |
commit | daff5656e2ffbec65db73cad3c0f997e6a1e7667 (patch) | |
tree | 3401d1607d7b5dd0510da4bb585e4085a07b2a99 /src/widgets/kernel/qwidget_qpa.cpp | |
parent | afbad00a4d9ff28967ca15e0f9029925e86f2cf4 (diff) |
QQuickWidget: fix crash on exit
Make sure that the correct context is current when freeing GL resources.
Otherwise, on shutdown, QOpenGLVertexArrayObject would try to use the
previously current context, which mmay already have been deleted.
Task-number: QTBUG-37385
Change-Id: Ib2332f54636738a1a4b1041a7dcbffd0af00261d
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3f0b0936c3..88a08060c1 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -945,10 +945,21 @@ void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { //the qplatformbackingstore may hold a reference to the window, so the backingstore - //needs to be deleted first + //needs to be deleted first. If the backingstore holds GL resources, we need to + // make the context current here, since the platform bs does not have a reference + // to the widget. + +#ifndef QT_NO_OPENGL + if (textureChildSeen && extra->topextra->shareContext) + extra->topextra->shareContext->makeCurrent(extra->topextra->window); +#endif extra->topextra->backingStoreTracker.destroy(); delete extra->topextra->backingStore; extra->topextra->backingStore = 0; +#ifndef QT_NO_OPENGL + if (textureChildSeen && extra->topextra->shareContext) + extra->topextra->shareContext->doneCurrent(); +#endif //the toplevel might have a context with a "qglcontext associated with it. We need to //delete the qglcontext before we delete the qplatformopenglcontext. |