From 9cb38baaf88b9f50eeed028ab66421c462f3124a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 30 Mar 2015 15:11:37 +0200 Subject: [PATCH] iOS: check if Qt has an active window before scrolling to cursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In hybrid applications an external view can be first reponder. And when that is the case, Qt will have no active windows and focusView will return 0. We therefore need to protect scrollToCursor from this case, so it doesn't try to access e.g focusView().window, which will lead to a crash. Task-number: QTBUG-45182 Change-Id: I87d470631f5beda22fd64fc1f2b0f7259344f830 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 2ebd87f29c8..090df66e0d3 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -437,6 +437,9 @@ void QIOSInputContext::scrollToCursor() if (!rootView) return; + if (!focusView()) + return; + if (rootView.window != focusView().window) return;