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

Deadlock occurs when QImage::scaled is called in QtConcurrent::run

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15.0
    • Core: QtConcurrent
    • None
    • Windows

      The following code snippet causes a deadlock of the thread pool if the number of files selected exceeds the number of available threads. The call of QImage::scaled does not return. The execution stops when calling QSemaphore::acquire in static inline void multithread_pixels_function (qimagescale_sse4.cpp).

      With Qt version 5.14.0 the code works fine.

      ...
      QStringList fileNames = QFileDialog::getOpenFileNames(nullptr, tr("Select Image Files"),
      QString(),
      tr("JPG (*.jpg)"));
      for ( const QString& path : fileNames ) {
      QtConcurrent::run([path]() {
      QImage img(path);

      if ( !img.isNull() )

      { img = img.scaled(100, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation); }

      });
      }
      ...

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

            allan.jensen Allan Sandfeld Jensen
            rkubsch Rainer Kubsch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes