macOS: Check m_platformWindow before processing key event after shortcut

Processing shortcut events may result in the window being deleted, so
we need to check if m_platformWindow is still valid before continuing
with the key press event.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-105160
Change-Id: I9cd362873b19c078a4fced3ac3c815d70bfc7fbe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Timur Pocheptsov 2022-08-05 13:44:34 +02:00 committed by Tor Arne Vestbø
parent d336cfba8a
commit 6a5cadb955

View File

@ -32,7 +32,7 @@
}
}
QObject *focusObject = m_platformWindow->window()->focusObject();
QObject *focusObject = m_platformWindow ? m_platformWindow->window()->focusObject() : nullptr;
if (m_sendKeyEvent && focusObject) {
if (auto queryResult = queryInputMethod(focusObject, Qt::ImHints)) {
auto hints = static_cast<Qt::InputMethodHints>(queryResult.value(Qt::ImHints).toUInt());