From 07549de92bcb2e138c2f3c8d555092054a5359db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 18 Mar 2014 13:34:00 +0100 Subject: [PATCH] Delete the OpenGL context before the window. Fix a crash-on-exit on Mac, where deleting the context references the attached NSView. Change-Id: Iac38184dab7a406e4072452fd9a6b175e6968ade Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidget_qpa.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 88a08060c1..85ae55b8ac 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -959,6 +959,8 @@ void QWidgetPrivate::deleteTLSysExtra() #ifndef QT_NO_OPENGL if (textureChildSeen && extra->topextra->shareContext) extra->topextra->shareContext->doneCurrent(); + delete extra->topextra->shareContext; + extra->topextra->shareContext = 0; #endif //the toplevel might have a context with a "qglcontext associated with it. We need to @@ -972,10 +974,6 @@ void QWidgetPrivate::deleteTLSysExtra() delete extra->topextra->window; extra->topextra->window = 0; -#ifndef QT_NO_OPENGL - delete extra->topextra->shareContext; - extra->topextra->shareContext = 0; -#endif } }