summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-01-31 18:08:08 +0100
committerIvan Solovev <ivan.solovev@qt.io>2022-02-09 16:48:26 +0100
commit6d00aac1092d813446a44fbb234995733233f003 (patch)
treec7dc995d65aa026fbbf81d32982c3bb9b03ec860 /src/plugins
parent81178294f1ed5fc98944c9d83b38a70523965b17 (diff)
downloadqtbase-6d00aac1092d813446a44fbb234995733233f003.tar.gz
Android: extract parentId for hidden object in advance
This commit amends 850a7f1238e84b6960a84e12687e40cf939a44d9. We can't extract the parentId for the hidden object on Java side, because the Java call is executed in a separate thread, so the original hidden object can be destroyed somewhere in the middle of parentId() call. As a workaround, we get the parentId in advance, on C++ side, and pass it as a parameter to JNI function. Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: Ied2ab4ab39b947f3f582575cf77cc76fbac9e274 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp6
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp5
-rw-r--r--src/plugins/platforms/android/androidjnimain.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index 62460f5e6d..10a71bca4a 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -113,9 +113,13 @@ namespace QtAndroidAccessibility
QtAndroid::notifyAccessibilityLocationChange();
}
+ static jint parentId(JNIEnv *, jobject, jint objectId); // forward declaration
+
void notifyObjectHide(uint accessibilityObjectId)
{
- QtAndroid::notifyObjectHide(accessibilityObjectId);
+ jobject unused {};
+ const auto parentObjectId = parentId(nullptr, unused, accessibilityObjectId);
+ QtAndroid::notifyObjectHide(accessibilityObjectId, parentObjectId);
}
void notifyObjectFocus(uint accessibilityObjectId)
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index e99dca17a2..9816dfb93e 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -215,9 +215,10 @@ namespace QtAndroid
QJniObject::callStaticMethod<void>(m_applicationClass, "notifyAccessibilityLocationChange");
}
- void notifyObjectHide(uint accessibilityObjectId)
+ void notifyObjectHide(uint accessibilityObjectId, uint parentObjectId)
{
- QJniObject::callStaticMethod<void>(m_applicationClass, "notifyObjectHide","(I)V", accessibilityObjectId);
+ QJniObject::callStaticMethod<void>(m_applicationClass, "notifyObjectHide", "(II)V",
+ accessibilityObjectId, parentObjectId);
}
void notifyObjectFocus(uint accessibilityObjectId)
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index c7dd5c0ca0..5ebf8c5048 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -101,7 +101,7 @@ namespace QtAndroid
jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
void notifyAccessibilityLocationChange();
- void notifyObjectHide(uint accessibilityObjectId);
+ void notifyObjectHide(uint accessibilityObjectId, uint parentObjectId);
void notifyObjectFocus(uint accessibilityObjectId);
void notifyQtAndroidPluginRunning(bool running);