summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2021-03-26 10:49:45 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-30 05:47:12 +0000
commit0ffd09bc3038920e02fb8934fe885184064a116a (patch)
tree5b9b549048253ffb06a86effa4f4043b5381bb30
parent25c0017ddfb7136038f9c56393803a898c1d3d1e (diff)
iOS: Protect against a possible crash after the window is deleted
If we are in a case where the original window is deleted before a new one is shown then we need to make sure that we are not still expecting that the original one has the focus. So we protect against the crash by only outputting the address of the object that previously had focus. A follow-up patch will be done for inclusion from 6.2 that will fix the root cause of the pointer being invalid when the only window is deleted before a new one is shown. Fixes: QTBUG-92173 Change-Id: Ifdb3fd6b6cb8fb8e8b79d2c325a30c27b298d8a9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit b050d4867f68c3d35493221d65d343749504c988) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm3
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index 4e5fb630d4..af6f41cb9d 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -667,7 +667,8 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
// focus object. We try to detect code paths that fail this assertion and smooth
// over the situation by doing a manual update of the focus object.
if (qApp->focusObject() != m_imeState.focusObject && updatedProperties != Qt::ImQueryAll) {
- qWarning() << "stale focus object" << m_imeState.focusObject << ", doing manual update";
+ qWarning() << "stale focus object" << static_cast<void *>(m_imeState.focusObject)
+ << ", doing manual update";
setFocusObject(qApp->focusObject());
return;
}
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 0bcec81a53..8182b2cb7a 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -46,6 +46,7 @@
#include "qiosscreen.h"
#include "qiosviewcontroller.h"
#include "quiview.h"
+#include "qiosinputcontext.h"
#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformintegration.h>