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

Race condition when starting QQuickImageResponse

    XMLWordPrintable

Details

    Description

      The code creating a QQuickImageResponse has a race condition:

      qtdeclarative/src/quick/util/qquickpixmapcache.cpp
                  case QQuickImageProvider::ImageResponse:
                  {
                      QQuickAsyncImageProvider *asyncProvider = static_cast<QQuickAsyncImageProvider*>(provider);
                      QQuickImageResponse *response = asyncProvider->requestImageResponse(imageId(url), runningJob->requestSize);
      
                      QObject::connect(response, SIGNAL(finished()), threadObject, SLOT(asyncResponseFinished()));
      
                      asyncResponses.insert(response, runningJob);
                      break;
                  }
      

      If the processing is finished very fast (e.g. multi-threaded), QQuickImageResponse will send finished() signal before QQuickPixmapCache has a chance to connect() to it and the image will never be shown.

      A possible solution would be to introduce a new method QQuickImageResponse::start() that should be called after the connection has been established.

      Attachments

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

        Activity

          People

            shausman Simon Hausmann
            alexbusenius Alex Busenius
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes