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

Possible deadlock while starting an Android service

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.2.0 FF
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      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

          Issue Links

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

            Activity

              People

              Assignee:
              qtandroidteam Qt Android Team
              Reporter:
              ivan.solovev Ivan Solovev
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes