Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128824

[Android] Selecting item from context menu in widgets application causes the app to crash

    XMLWordPrintable

Details

    • Android

    Description

      MacOS 14.6.1

      Qt Creator 14.0.2

      Qt 6.8.0

       

      Device: Samsung Galaxy S22 14.0

      Steps to reproduce:

      1. Open the attached sample project. 
      2. Run the app on Android device.
      3. Once the app is launched tap on the center on the screen, so that the windows 'gets the focus'
      4. Open context menu and select any option.

      Expected: The app should not crash.

      Actual: The app crashes:

      E AndroidRuntime: FATAL EXCEPTION: main
      E AndroidRuntime: Process: org.qtproject.example.widget_contex, PID: 1071
      E AndroidRuntime: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
      E AndroidRuntime:     at android.view.ViewGroup.addViewInner(ViewGroup.java:5509)
      E AndroidRuntime:     at android.view.ViewGroup.addView(ViewGroup.java:5328)
      E AndroidRuntime:     at android.view.ViewGroup.addView(ViewGroup.java:5300)
      E AndroidRuntime:     at org.qtproject.qt.android.QtLayout.setLayoutParams(QtLayout.java:212)
      E AndroidRuntime:     at org.qtproject.qt.android.QtActivityDelegate.lambda$openContextMenu$9$org-qtproject-qt-android-QtActivityDelegate(QtActivityDelegate.java:302)
      E AndroidRuntime:     at org.qtproject.qt.android.QtActivityDelegate$$ExternalSyntheticLambda9.run(D8$$SyntheticClass:0)
      E AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:958)
      E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99)
      E AndroidRuntime:     at android.os.Looper.loopOnce(Looper.java:230)
      E AndroidRuntime:     at android.os.Looper.loop(Looper.java:319)
      E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:8919)
      E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
      E AndroidRuntime:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
      E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) 

      Reproducibility:  100% **

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtandroidteam Qt Android Team
              lkos Łukasz Kosiorowski
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes