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

QDeclarativeEngine::setNetworkAccessManagerFactory can lead to problems with QML image loader thread

    XMLWordPrintable

Details

    • 29e3302213cd5b33c01ee0ba7c5fe3d036faf902

    Description

      We're using QDeclarativeEngine::setNetworkAccessManagerFactory to provide QDeclarativeEngine our custom network access manager which did some additional logging. We connected our network access managers authenticationRequired signal to slot in one of our application logic classes, to provide the BASIC authentication for images QML loads from our web server. Occasionally, loading images would fail with error message like QML Image: Authentication required. We were unable to pin point the final reason but our current hypothesis is this:

      Remote QML images are downloaded in separate thread. A network access manager instance is created for that thread. Once the network access manager sends the authenticationRequired signal, it's delivered as Qt::QueuedConnection. We're afraid that that the image loader thread has no way of knowing when the slot connected to that signal has provided the QAuthenticator object with credentials. Usually our program worked, some times it didn't, maybe depending on the order the event loops were running.

      We had also a slot (in main thread) connected to signal finished(QNetworkReply*) which occasionally crashed, the QNetworkReply* pointer seemed to be invalid, probably already deleted. Our fix was to move all the connected slots to the custom network access manager class, to avoid cross-thread signals. It's difficult to know whether this solved the problem forever since it occurs only now and then.

      But please, you know the source, can this be actual issue, should it be documented or is there way to fix it?

      Attachments

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

        Activity

          People

            bealam Bea Lam (closed Nokia identity) (Inactive)
            jaakko.tuosa Jaakko Tuosa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes