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

QtQuickView doesn't handle recreation of Activity properly

    XMLWordPrintable

Details

    • Android
    • 6d2db42f7 (dev), aef9fff1d (dev), d8570cb1a (6.8)

    Description

      If the embedding Activity is recreated, for example due to orientation change, resources don't seem to be properly cleared up, leading to a crash after enough recreations have happened.

      When the Activity is recreated, for example due to not-overridden orientation change, the app gets stuck.

      Before https://codereview.qt-project.org/c/qt/qtbase/+/557217 whenever the Activity got destroyed, we also called system.exit(), hence quitting the whole app, and it just got restarted with the new Activity, making it look like it worked, for a while. However, removing the system.exit() call lead to other issues, like the QtThread instance already being stopped.

      Steps to reproduce:

      • Remove the line android:configChanges="orientation|screenLayout|screenSize" from the example's (qtquickview_java or another embedded QML example) AndroidManifest.xml
      • start the example
      • switch the orientation of the emulator/device

      Updated steps to reproduce now that the Activity does not get recreated when switching orientation:

      • Have an Android app that has a QtQuickView (one of the examples is fine)
      • To the Activity of that app, add a button and set its click handler:
        • // Add the Button in the XML layout with ID "button", add the following to Activity's onCreate():
          Button button = findViewById(R.id.button);
          button.setOnClickListener(view -> finish()));
      • Click the button to finish/destroy the Activity
      • Restart the Activity normally, i.e. clicking the icon on the launcher

      Attachments

        Issue Links

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

          Activity

            People

              tinjapaavoseppa Tinja Paavoseppä
              tinjapaavoseppa Tinja Paavoseppä
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes