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

QQuickPixmapCache fails downloading remote images when USE_THREADED_DOWNLOAD is 0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.5.0
    • None
    • Qt 6.5.0 for macOS and for Web Assembly (both single- and multi-threaded)
    • macOS, WebAssembly

    Description

      For platforms where USE_THREADED_DOWNLOAD is 0, like Web Assembly or desktop builds configured with -no-feature-thread, QQuickPixmapCache does not properly handle remote sources for QML Image elements. Image's status property hangs at Image.Loading (tried with both http and https sources).

      After some investigation, I've noticed that, at QQuickPixmapReader::run(), the qScopeGuard seems to destroy threadObject before the download is fully completed:

      const auto guard = qScopeGuard([this]()
      {         // We need to delete the threadObject from the same thread.         QMutexLocker lock(&mutex);         delete threadObject;         threadObject = nullptr;     }
      );
      

      That happens because the event loop created by exec() isn't invoked when USE_THREADED_DOWNLOAD is 0:

      #if USE_THREADED_DOWNLOAD
          exec();
      #endif

      Commenting out (or surrounding with #if USE_THREADED_DOWNLOAD) the qScopeGuard block "fixes" the issue but I'm not sure whether threadObject is actually instantiated for non-threaded builds (which then would generate a memory leak if so).

      NOTE: this isn't exclusive of Web Assembly builds, it also happens for macOS desktop builds with -no-feature-thread.

      Minimal example attached.

       

      Attachments

        Issue Links

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

          Activity

            People

              mikolaj.boc Mikołaj Boc (Inactive)
              sandroandrade Sandro S. Andrade
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes