From 8586cccc071240a8eff6c5aa53a90010dae55193 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 21 Apr 2016 10:14:23 +0200 Subject: iOS: (crash fix) ensure we don't clear focus object in a text responder transition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When IM hints changes (e.g as a result of transferring focus between Qt objects), we sometimes need to reconfigure the keyboard. And the way we do that is to create a new QIOSTextResponder that matches the new configuration and tell it to become first responder. And in that process we need to ensure that we don't clear the focus object when the old text responder resigns. After all, it was the one requesting the new IM configuration in the first place. Since we set FirstResponderCandidate to point to the new text responder just before telling the old one to resign, we can use that variable to check if were in a first responder transition before clearing the focus object. Change-Id: I05bfb8180700a92a8f14f496044457583bcd38d3 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 6a66bf213e..eb12739e98 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -324,7 +324,7 @@ // a regular responder transfer to another window. In the former case, iOS // will set the new first-responder to our next-responder, and in the latter // case we'll have an active responder candidate. - if (![UIResponder currentFirstResponder]) { + if (![UIResponder currentFirstResponder] && !FirstResponderCandidate::currentCandidate()) { // No first responder set anymore, sync this with Qt by clearing the // focus object. m_inputContext->clearCurrentFocusObject(); -- cgit v1.2.3