summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2013-12-03 13:55:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-04 09:11:39 +0100
commit32f71db1bdcf93c8a03a9ef11ff4044479afa369 (patch)
treef0d1bc3a0e03cd3209b0f36a7a93f89bb5ced0cc /src/plugins
parentdd97932a04c1ef27d0e4d73b701acc2aad411b07 (diff)
iOS: fix crash when application quits
An application will sometimes crash if the keyboard is told to hide while the application is about to quit. This patch will ensure that we set m_qioswindow (and [UIView qwindow]) to 0 when the window is destroyed. We also check this pointer before telling QUIView to resign first responder when closing the keyboard. The latter will fix the crash. Task-number: QTBUG-35356 Change-Id: I934088beb7e877c5b33d96225cb215a8ffd4dbb2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 43f36e32e0..7b217e0bdc 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -341,7 +341,8 @@
// Resigning first responed status means that the virtual keyboard was closed, or
// some other view became first responder. In either case we clear the focus object to
// avoid blinking cursors in line edits etc:
- static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject();
+ if (m_qioswindow)
+ static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject();
return [super resignFirstResponder];
}
@@ -423,8 +424,10 @@
- (QWindow *)qwindow
{
- if ([self isKindOfClass:[QUIView class]])
- return static_cast<QUIView *>(self)->m_qioswindow->window();
+ if ([self isKindOfClass:[QUIView class]]) {
+ if (QIOSWindow *w = static_cast<QUIView *>(self)->m_qioswindow)
+ return w->window();
+ }
return nil;
}
@@ -461,6 +464,7 @@ QIOSWindow::~QIOSWindow()
// cancellation of all touch events.
[m_view touchesCancelled:0 withEvent:0];
+ m_view->m_qioswindow = 0;
[m_view removeFromSuperview];
[m_view release];
}