summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed El Khazari <[email protected]>2025-08-11 07:54:51 +0300
committerQt Cherry-pick Bot <[email protected]>2025-08-17 16:16:08 +0000
commit6f0d27d2e4ba5fa6562f738aaaf8eaf98ebf51e7 (patch)
tree20d56ec7c4aa0a5a77d3b5e7fa122e067f8e1839
parent4bf60d0a6458d2191c5e898d7c4d55937a91ff33 (diff)
Android: Fix crash when parent window is detached but view reference remains6.9.2
This commit addresses a crash that occurs when the parent window is destroyed while the view reference is still held. The crash happens when the callback onAttachedToWindow is triggered and the QuickView.createQuickView() function is called in native code. In this scenario, the view reference is still pointing to the previous QuickView whose parent has already been cleared, causing the crash. To fix this, we reset the reference to 0 when the parent is deleted or destroyed. This ensures that when onAttachedToWindow is called again, the view is properly recreated after its underlying window has been destroyed. Fixes: QTBUG-138922 Change-Id: Ia39eb83b58af19cd9b881915215b2be2adcfee49 (cherry picked from commit 8194e979fc58f71244f625f320a797d4550524c9) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit e205d6b2acf23b76ec80277d3add3851210683be) (cherry picked from commit e893262b0610be986eaade5e8ea5119a09fd93ea)
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtView.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtView.java b/src/android/jar/src/org/qtproject/qt/android/QtView.java
index afe4d005402..b60c58013f5 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtView.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtView.java
@@ -200,6 +200,7 @@ abstract class QtView extends ViewGroup implements QtNative.AppStateDetailsListe
if (m_parentWindowReference != 0L)
deleteWindow(m_parentWindowReference);
m_parentWindowReference = 0L;
+ setWindowReference(0L);
}
QtWindow getQtWindow() {