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 <gabriel.dedietrich@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Morten Johan Sørvig 2014-02-17 11:39:25 +01:00 committed by The Qt Project
parent f2ade01f4c
commit 72ba4cd385

View File

@ -162,6 +162,9 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
QCocoaGLContext::~QCocoaGLContext()
{
if (m_currentWindow && m_currentWindow.data()->handle())
static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
[m_context release];
}