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>
This commit is contained in:
parent
dd97932a04
commit
32f71db1bd
@ -341,6 +341,7 @@
|
||||
// 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:
|
||||
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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user