From c0ba4ad49d9099e723518d9f4384e00bfb6ae1a7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 5 Oct 2023 13:59:57 +0200 Subject: [PATCH] QtAndroidAccessibility: fix unneeded runtime initialization Initializing QPointer with nullptr is currently still going through the (T*) ctor, which is not constexpr, so is initialized at runtime. This will change in Qt 6.7, but that doesn't help the older branches. Use the default constructor, which is constexpr, and assert that no runtime initialization happens by using Q_CONSTINIT. Amends f9297565784e7eae87588417c8080cc1c9eede5f. Not picking to 6.2, 5.15 because, while affected, they're in too stable a mode for this, and they also lack Q_CONSTINIT. Pick-to: 6.6 6.5 Change-Id: I41bb6f36d529effda008f166fd05a8896157edc9 Reviewed-by: Ivan Solovev --- src/plugins/platforms/android/androidjniaccessibility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 8990289dc47..e66f9e19f2e 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -48,7 +48,7 @@ namespace QtAndroidAccessibility // Because of that almost every method here is split into two parts. // The _helper part is executed in the context of m_accessibilityContext // on the main thread. The other part is executed in Java thread. - static QPointer m_accessibilityContext = nullptr; + Q_CONSTINIT static QPointer m_accessibilityContext = {}; // This method is called from the Qt main thread, and normally a // QGuiApplication instance will be used as a parent.