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

[Reg 6.5 -> 6.8.2] Calling QCoreApplication::requestPermission() inside QQuickItem::componentComplete() causes an OpenGL crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8.2
    • GUI: Other
    • Pixel 4 Emulator x86_64, API Level 31
    • Android

    Description

      See attached project, which now crashes at startup.

       

      Code

      #include <QQuickItem>
      #include <QPermissions>
      
      //#define DEFER_REQUEST
      
      class MyItem : public QQuickItem
      {
          Q_OBJECT
          QML_ELEMENT
      
      public:
          MyItem(QQuickItem *parent = nullptr) : QQuickItem(parent) {}
          void componentComplete() override
          {
              qDebug() << "componentComplete() thread:" << QThread::currentThread();
              QQuickItem::componentComplete();
              initiateLocation();
          }
      
      private:
          void initiateLocation()
          {
              qDebug() << "initiateLocation() thread:" << QThread::currentThread();
      
              QLocationPermission locationPermission{};
              locationPermission.setAccuracy(QLocationPermission::Accuracy::Approximate);
              locationPermission.setAvailability(QLocationPermission::Availability::WhenInUse);
      
              switch (qApp->checkPermission(locationPermission))
              {
              case Qt::PermissionStatus::Undetermined:
      
      #ifndef DEFER_REQUEST
                  qApp->requestPermission(locationPermission, this, &MyItem::initiateLocation);
                  qDebug() << "Requested permission";
      #else
                  QMetaObject::invokeMethod(this, [=]{
                      qApp->requestPermission(locationPermission, this, &MyItem::initiateLocation);
                      qDebug() << "Requested permission";
                  }, Qt::QueuedConnection);
      #endif
                  return;
      
              default:
                  qDebug() << "Permission already determined";
                  return;
              }
          }
      };
      

       

      Outcome at startup

      D/default : componentComplete() thread: QThread(0x78fefde237f0, name = "QtMainLoopThread")
      D/default : initiateLocation() thread: QThread(0x78fefde237f0, name = "QtMainLoopThread")
      D/default : Requested permission
      D/HostConnection: createUnique: call
      D/HostConnection: HostConnection::get() New Host Connection established 0x78ff7de1c290, tid 26220
      D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
      D/EGL_emulation: eglCreateContext: 0x78ff7de24750: maj 3 min 0 rcv 3
      D/EGL_emulation: eglMakeCurrent: 0x78ff7de24750: ver 3 0 (tinfo 0x79019a46d100) (first time)
      D/HostConnection: createUnique: call
      D/HostConnection: HostConnection::get() New Host Connection established 0x78ff7de1a910, tid 26261
      D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
      D/EGL_emulation: eglCreateContext: 0x78ff7de1ae50: maj 3 min 0 rcv 3
      D/EGL_emulation: eglMakeCurrent: 0x78ff7de1ae50: ver 3 0 (tinfo 0x79019a46d180) (first time)
      W/default : QRhiGles2: Failed to make context current. Expect bad things to happen.
      W/default : Failed to create RHI (backend 2)
      W/default : Failed to create QRhi on the render thread; scenegraph is not functional
      F/default : Failed to initialize graphics backend for OpenGL.
      F/libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 26220 (qtMainLoopThrea), pid 26183 (PermissionsTest)
      F/DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      F/DEBUG   : Build fingerprint: 'google/sdk_gphone64_x86_64/emulator64_x86_64_arm64:12/SE1A.211212.001.B1/8023802:user/release-keys'
      Art: Compiled App Profiles.
      F/DEBUG   : Revision: '0'
      F/DEBUG   : ABI: 'x86_64'
      F/DEBUG   : Timestamp: 2025-02-28 20:41:58.334067000+0800
      F/DEBUG   : Process uptime: 0s
      F/DEBUG   : Cmdline: org.qtproject.example.appQuickPermissionsTest
      F/DEBUG   : pid: 26183, tid: 26220, name: qtMainLoopThrea  >>> org.qtproject.example.appQuickPermissionsTest <<<
      F/DEBUG   : uid: 10165
      F/DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
      F/DEBUG   : Abort message: 'Failed to initialize graphics backend for OpenGL.
      F/DEBUG   : '
      F/DEBUG   :     rax 0000000000000000  rbx 0000000000006647  rcx 00007901862df5cf  rdx 0000000000000006
      F/DEBUG   :     r8  000078fe74abdbaf  r9  000078fe74abdbaf  r10 000078fe81ef3a40  r11 0000000000000207
      F/DEBUG   :     r12 000078fe81ef3c80  r13 000078fefde37650  r14 000078fe81ef3a38  r15 000000000000666c
      F/DEBUG   :     rdi 0000000000006647  rsi 000000000000666c
      F/DEBUG   :     rbp 000000006de55101  rsp 000078fe81ef3a30  rip 00007901862df5cf
      F/DEBUG   : backtrace:
      F/DEBUG   :       #00 pc 000000000005e5cf  /apex/com.android.runtime/lib64/bionic/libc.so (abort+191) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
      F/DEBUG   :       #01 pc 000000000031a866  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #02 pc 000000000031f16a  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #03 pc 000000000032033e  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QMessageLogger::fatal(char const*, ...) const+210) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #04 pc 00000000004d270f  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Quick_x86_64.so (QSGRenderLoop::handleContextCreationFailure(QQuickWindow*)+435) (BuildId: 0bff59824f3de6a5ccc93ee294c2ad654b839604)
      F/DEBUG   :       #05 pc 00000000004680e0  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Quick_x86_64.so (QQuickWindow::event(QEvent*)+3582) (BuildId: 0bff59824f3de6a5ccc93ee294c2ad654b839604)
      F/DEBUG   :       #06 pc 00000000004745ed  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Quick_x86_64.so (QQuickWindowQmlImpl::event(QEvent*)+315) (BuildId: 0bff59824f3de6a5ccc93ee294c2ad654b839604)
      F/DEBUG   :       #07 pc 0000000000374059  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QCoreApplication::notifyInternal2(QObject*, QEvent*)+137) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #08 pc 0000000000374d1a  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)+478) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #09 pc 0000000000491b7b  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)+81) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #10 pc 0000000000682215  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Gui_x86_64.so (QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)+13) (BuildId: c15d19820d2ab79b96f71c1c53ae632dc1611892)
      F/DEBUG   :       #11 pc 000000000006752d  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libplugins_platforms_qtforandroid_x86_64.so (BuildId: 8ae73a394de8a3741508fcc5a69b84b4401937ae)
      F/DEBUG   :       #12 pc 000000000037b1cd  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)+325) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #13 pc 0000000000374591  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libQt6Core_x86_64.so (QCoreApplication::exec()+155) (BuildId: 41eaa638714d4dc6ece3d1ce66e487059e996470)
      F/DEBUG   :       #14 pc 00000000000173e4  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libappQuickPermissionsTest_x86_64.so (main+420) (BuildId: 3ea1f5848c05cafc046318587d58cf7796bdbd2d)
      F/DEBUG   :       #15 pc 000000000005ea17  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/lib/x86_64/libplugins_platforms_qtforandroid_x86_64.so (BuildId: 8ae73a394de8a3741508fcc5a69b84b4401937ae)
      F/DEBUG   :       #16 pc 00000000003a032b  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+219) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #17 pc 0000000000395376  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+806) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #18 pc 000000000041da09  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+233) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #19 pc 00000000005a335c  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+428) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #20 pc 000000000059d16c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1036) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #21 pc 000000000097c172  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+1410) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #22 pc 000000000037e899  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+25) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #23 pc 00000000001ffa64  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/base.apk
      F/DEBUG   :       #24 pc 0000000000594b42  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+306) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #25 pc 000000000059c55b  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+203) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #26 pc 000000000059d14d  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1005) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #27 pc 0000000000975bfc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1900) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #28 pc 000000000037e919  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+25) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #29 pc 0000000000201764  /data/app/~~S9aSStKaejKbGHPVmmGnfw==/org.qtproject.example.appQuickPermissionsTest-XjCXOnPqFb_x0ktEcRcZOw==/base.apk
      F/DEBUG   :       #30 pc 0000000000594b42  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+306) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #31 pc 000000000059c55b  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+203) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #32 pc 000000000059d14d  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1005) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #33 pc 0000000000975bfc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1900) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #34 pc 000000000037e919  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+25) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #35 pc 00000000000eda70  /apex/com.android.art/javalib/core-oj.jar
      F/DEBUG   :       #36 pc 0000000000594b42  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+306) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #37 pc 0000000000959a6f  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1007) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #38 pc 00000000003a04bc  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+140) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #39 pc 0000000000395014  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+756) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #40 pc 000000000041d9fa  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+218) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #41 pc 000000000081aafe  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+478) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #42 pc 000000000087a0cf  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1343) (BuildId: cfc3de5d1c7b2855effeb77a784fc353)
      F/DEBUG   :       #43 pc 00000000000c758a  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
      F/DEBUG   :       #44 pc 000000000005fd87  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
      

       

      Workarounds

      Attachments

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

        Activity

          People

            assam Assam Boudjelthia
            skoh-qt Sze Howe Koh
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes