From aac24582c623a87b65733151b5f6af9771862b66 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 31 Aug 2012 16:29:11 +0300 Subject: Cocoa GL context: do not crash when closing windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 4 ++-- 1 file 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(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(m_currentWindow.data()->handle())->setCurrentContext(0); m_currentWindow.clear(); -- cgit v1.2.3