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

QNativeInterface::QAndroidApplication::context() crash

    XMLWordPrintable

Details

    • Android
    • 2024wk32s2FOQtforAndroid

    Description

      A crash occurs when QNativeInterface::QAndroidApplication::context() is invoked from a library on Android if there's a mismatch in Qt versions between the library (using Qt 6.5.6) and the application (using Qt 6.7.2).

      To illustrate, I created a lightweight example where QtAndroidLibraryWrapper is built with Qt 6.5.6. If an application, such as TestAndroidLibraryWrapper, is built with 6.7.2 and invokes a function from this library that in turn calls QNativeInterface::QAndroidApplication::context(), the application crashes as demonstrated by the attached call stack.

      However, direct calls to QNativeInterface::QAndroidApplication::context() from the application, regardless of the Qt version, do not lead to crashes. Similarly, if both the library and the application are compiled with the same version of Qt, the call proceeds without issues.

      The issue specifically arises when a library compiled with Qt 6.5.6 is used by an application compiled with Qt 6.7.2, leading to a crash upon calling QNativeInterface::QAndroidApplication::context().

       

      The library and application were both compiled for arm64-v8a architecture when I discovered this. I can't attach a zip of the repro as it is too large (~90MB), here is a repo link: https://github.com/bri12415/QtAndroidLibraryWrapper

      Attachments

        1. Callstack.txt
          6 kB
          Brian Noble

        Issue Links

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

          Activity

            People

              assam Assam Boudjelthia
              brno4758 Brian Noble
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes