diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm index 7222bf67937..41c75dcac8f 100644 --- a/src/plugins/platforms/ios/qiosservices.mm +++ b/src/plugins/platforms/ios/qiosservices.mm @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -56,6 +57,7 @@ bool QIOSServices::openUrl(const QUrl &url) return false; } + // avoid recursing back into self if (url == m_handlingUrl) return false; @@ -94,16 +96,12 @@ bool QIOSServices::openDocument(const QUrl &url) /* Callback from iOS that the application should handle a URL */ bool QIOSServices::handleUrl(const QUrl &url) { - QUrl previouslyHandling = m_handlingUrl; - m_handlingUrl = url; + QScopedValueRollback rollback(m_handlingUrl, url); // FIXME: Add platform services callback from QDesktopServices::setUrlHandler // so that we can warn the user if calling setUrlHandler without also setting // up the matching keys in the Info.plist file (CFBundleURLTypes and friends). - bool couldHandle = QDesktopServices::openUrl(url); - - m_handlingUrl = previouslyHandling; - return couldHandle; + return QDesktopServices::openUrl(url); } QT_END_NAMESPACE