summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.mm
diff options
context:
space:
mode:
authorLaszlo Agocs <lagocs83@gmail.com>2012-08-31 16:29:11 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-20 07:02:00 +0200
commitaac24582c623a87b65733151b5f6af9771862b66 (patch)
tree1a7d04e0307e508ded2d105f99197c224669c6ce /src/plugins/platforms/cocoa/qcocoaglcontext.mm
parent4b664eef64d5d51ba8de0e9792ba1c0f9883fa81 (diff)
Cocoa GL context: do not crash when closing windows
Running hellowindow and closing its windows one by one would result in crashes without the additional checks for the presence of the underlying native window. Change-Id: Id32bdfda9a77936380b2e9a95fb56ceb52028d9d Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 0292e02ff1..4dd19622e1 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -103,7 +103,7 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
if (window == m_currentWindow.data())
return;
- if (m_currentWindow)
+ if (m_currentWindow && m_currentWindow.data()->handle())
static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
Q_ASSERT(window->handle());
@@ -119,7 +119,7 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
void QCocoaGLContext::doneCurrent()
{
- if (m_currentWindow)
+ if (m_currentWindow && m_currentWindow.data()->handle())
static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
m_currentWindow.clear();