Android: Avoid lazy initialization of QAndroidPlatformServices

In commit ff51ea5418d131248b07e327513b41dad1231f37, lazy initialization
was introduced for QPlatformServices, including
QAndroidPlatformServices. However, this approach causes a regression.
When QAndroidPlatformServices is lazily initialized, the intent listener
registration is delayed. As a result, handling custom URL schemes is
affected - especially those coming from external applications.

To address this issue, this commit removes lazy initialization for
QAndroidPlatformServices.

Fixes: QTBUG-135489
Pick-to: 6.8 6.5
Change-Id: I24becdf4ac573e7a2ca101cfbc27560d1eb4adef
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 393c294e102bcd733141539552fda2f148e8b51b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Bartlomiej Moskal 2025-04-18 09:28:50 +02:00 committed by Qt Cherry-pick Bot
parent c3e0c0099f
commit 4019fca886
2 changed files with 2 additions and 4 deletions

View File

@ -220,6 +220,7 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
m_mainThread = QThread::currentThread();
m_androidFDB = new QAndroidPlatformFontDatabase();
m_androidPlatformServices.reset(new QAndroidPlatformServices);
#ifndef QT_NO_CLIPBOARD
m_androidPlatformClipboard = new QAndroidPlatformClipboard();
@ -456,9 +457,6 @@ QPlatformNativeInterface *QAndroidPlatformIntegration::nativeInterface() const
QPlatformServices *QAndroidPlatformIntegration::services() const
{
if (m_androidPlatformServices.isNull())
m_androidPlatformServices.reset(new QAndroidPlatformServices);
return m_androidPlatformServices.data();
}

View File

@ -136,7 +136,7 @@ private:
QPlatformFontDatabase *m_androidFDB;
QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
mutable QScopedPointer<QAndroidPlatformServices> m_androidPlatformServices;
QScopedPointer<QAndroidPlatformServices> m_androidPlatformServices;
// Handling the multiple screens connected. Every display is identified
// with an unique (autoincremented) displayID. The values of this ID will