Fix crash in tst_qmltc_examples on Android

tst_qmltc_examples failed because m_accessibilityContext
could become a dangling pointer if the object in points to gets
deleted. This resulted in a crash.
Amends e0c61193ea.

Task-number: QTBUG-101865
Task-number: QTBUG-95764
Pick-to: 6.3 6.2 5.15
Change-Id: Ie85118429b1afa6e4a41f899ca065f493e166570
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Andreas Buhr 2022-04-07 12:18:15 +02:00
parent 1007aac63a
commit f929756578
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,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 QObject *m_accessibilityContext = nullptr;
static QPointer<QObject> m_accessibilityContext = nullptr;
// This method is called from the Qt main thread, and normally a
// QGuiApplication instance will be used as a parent.