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

QtNetworkReceiver wont be unregistered in AndroidConnectivityManager

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.0 RC
    • QPA
    • None
    • Android

    Description

      Recently i faced a bug with qtnetworkconfiguration, i used it in qt android service, when the service destroyed, android warns about unregistered receivers, here is example output

       

      E/ActivityThread(10875): Service edu.sharif.iiscenter.khasis.KhasisService has leaked IntentReceiver org.qtproject.qt5.android.bearer.QtNetworkReceiver$BroadcastReceiverPrivate@228f85bd that was originally registered here. Are you missing a call to unregisterReceiver()?
      E/ActivityThread(10875): android.app.IntentReceiverLeaked: Service edu.sharif.iiscenter.khasis.KhasisService has leaked IntentReceiver org.qtproject.qt5.android.bearer.QtNetworkReceiver$BroadcastReceiverPrivate@228f85bd that was originally registered here. Are you missing a call to unregisterReceiver()?
      E/ActivityThread(10875):     at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:901)
      E/ActivityThread(10875):     at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:702)
      E/ActivityThread(10875):     at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1701)
      E/ActivityThread(10875):     at android.app.ContextImpl.registerReceiver(ContextImpl.java:1681)
      E/ActivityThread(10875):     at android.app.ContextImpl.registerReceiver(ContextImpl.java:1675)
      E/ActivityThread(10875):     at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:495)
      E/ActivityThread(10875):     at org.qtproject.qt5.android.bearer.QtNetworkReceiver.registerReceiver(QtNetworkReceiver.java:73)

       

      I looked at the code (dev branch) and found AndroidConnectivityManager instance never deconstructed in android's QNetworkConfigurationm_connectivityManager (https://github.com/RSATom/Qt/blob/master/qtbase/src/plugins/bearer/android/src/qandroidbearerengine.cpp) and thus the unregisterReceiver method of AndroidConnectivityManager never be called.

      AndroidConnectivityManager will be used as singleton instance in  QAndroidBearerEngine::initialize() but no one deconstruct it, thus when the application is killed the broadcast receiver unregistration never called.

      ex: i looked at the git, it seems this bug present from Qt 5.5.1

      Attachments

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

        Activity

          People

            rampe Rami Potinkara
            e.jahandar Ebrahun Jahandar
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes