Guard usage of m_cocoaPlatformWindow.

m_cocoaPlatformWindow is cleared when Qt is "done"
with the QNSWindow or QNSPanel to prevent messages
from Cocoa calling into possibly stale pointers.

Change-Id: Id42b794fedbd3e597a0c4b50584cca976ba74c0f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Morten Johan Sørvig 2013-03-20 15:06:37 +01:00 committed by The Qt Project
parent aa5f70c00a
commit 3f58fc00c9
1 changed files with 4 additions and 1 deletions

View File

@ -118,7 +118,7 @@ static bool isMouseEvent(NSEvent *ev)
// Windows with a transient parent (such as combobox popup windows)
// cannot become the main window:
if (m_cocoaPlatformWindow->window()->transientParent())
if (m_cocoaPlatformWindow && m_cocoaPlatformWindow->window()->transientParent())
canBecomeMain = NO;
return canBecomeMain;
@ -155,6 +155,9 @@ static bool isMouseEvent(NSEvent *ev)
- (BOOL)canBecomeKeyWindow
{
if (!m_cocoaPlatformWindow)
return NO;
// Only tool or dialog windows should become key:
if (m_cocoaPlatformWindow->window()->type() == Qt::Tool || m_cocoaPlatformWindow->window()->type() == Qt::Dialog)
return YES;