Skip to content

Commit

Permalink
iOS: Protect against a possible crash after the window is deleted
Browse files Browse the repository at this point in the history
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
Pick-to: 6.1 6.0 5.15
Change-Id: Ifdb3fd6b6cb8fb8e8b79d2c325a30c27b298d8a9
Reviewed-by: Tor Arne Vestbø <[email protected]>
  • Loading branch information
AndyShawQt committed Mar 29, 2021
1 parent ea0ee87 commit b050d48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/platforms/ios/qiosinputcontext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ - (void)reset
// 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;
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/platforms/ios/qioswindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit b050d48

Please sign in to comment.