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

Possible deadlock while starting an Android service

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.0 FF
    • Core: Other, QPA: Android
    • None
    • Android

    Description

      I've figured out that if I want to check the permissions directly from the main() function of the Android Service, it gets stuck. The same approach works well for the normal Activity.

      Some investigation shows that there might be a deadlock in QtNative.java.

      A QCoreApplication::checkPermission() call results in a call to checkSelfPermission() in QtNative.java. It attempts to lock the m_mainActivityMutex, which seems to be still locked by a call to startApplication().

      The straightforward solution is to run the QCoreApplication::checkPermission() from a QTimer::singleShot(), that will put it on the event loop.

       

      I'm attaching a small example that reproduces the problem.

      Attachments

        1. qtbug-94754.zip
          6 kB
          Ivan Solovev

        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
              ivan.solovev Ivan Solovev
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes