macOS: Bail out early when handling shortcut event results in closing window

When Cmd+W is used to close a window, check if m_platformWindow is still valid
before accessing window property.

Task-number: QTBUG-63389
Change-Id: I9abda19b8482e7a1fd07b07d8981b6a768e96c2e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Anders Hafreager 2017-09-28 09:11:20 +02:00 committed by Tor Arne Vestbø
parent ff2e9a17e7
commit cbbf843e96
1 changed files with 4 additions and 0 deletions

View File

@ -1559,6 +1559,10 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if (m_composingText.isEmpty()) {
m_sendKeyEvent = !QWindowSystemInterface::handleShortcutEvent(window, timestamp, keyCode,
modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
// Handling a shortcut may result in closing the window
if (!m_platformWindow)
return true;
}
QObject *fo = m_platformWindow->window()->focusObject();