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.9 6.8 6.5
Change-Id: I24becdf4ac573e7a2ca101cfbc27560d1eb4adef
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Bartlomiej Moskal 2025-04-18 09:28:50 +02:00
parent d446df7599
commit 393c294e10
2 changed files with 2 additions and 4 deletions

View File

@ -216,6 +216,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();
@ -452,9 +453,6 @@ QPlatformNativeInterface *QAndroidPlatformIntegration::nativeInterface() const
QPlatformServices *QAndroidPlatformIntegration::services() const
{
if (m_androidPlatformServices.isNull())
m_androidPlatformServices.reset(new QAndroidPlatformServices);
return m_androidPlatformServices.data();
}

View File

@ -123,7 +123,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