From 72ba4cd3858773757d3cc5a66f7859a483b6475b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 17 Feb 2014 11:39:25 +0100 Subject: [PATCH] Cocoa: Clear GL context pointer on deletion. The QGLWidget destructor sequence is such that the GL context will be deleted before the window is hidden. This would leave QCocoaWindow with a stale m_glContext pointer. Clear QCocoaWindow's context pointer on context deletion. Task-number: QTBUG-36820 Change-Id: I710e3813f9ce90ddd37ad7b406693f0c58a1436d Reviewed-by: Gabriel de Dietrich Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 6f76892d93..9b4d8fd96f 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -162,6 +162,9 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo QCocoaGLContext::~QCocoaGLContext() { + if (m_currentWindow && m_currentWindow.data()->handle()) + static_cast(m_currentWindow.data()->handle())->setCurrentContext(0); + [m_context release]; }