Details
-
Task
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.10.1
-
None
-
Windows 10, Qt 5.10.1 64-bit, both Debug and Release
Description
When using QFileIconProvider to get the file icon's pixmap in a multithreaded environment (e.g. for custom implementation of QML's QQuickImageProvider) the program hangs.
I managed to trace the problem to QShGetFileInfoThread (which always appears in the call-stack).
Minimal repro - 100% reproducible for me:
#include <QDebug> #include <QtConcurrent/QtConcurrentMap> #include <QApplication> #include <QDir> #include <QFileIconProvider> int main(int argc, char *argv[]) { QApplication a(argc, argv); QFileIconProvider provider; auto files = QDir("C:/Windows").entryList(QDir::Files); qDebug() << "starting for" << files.size() << "items"; std::atomic<int> count{0}; QtConcurrent::map(files, [&](auto file){ provider.icon(QFileInfo(file)).pixmap(60, 60); // << this line causes deadlock in QShGetFileInfoThread qDebug() << file << ++count << files.size(); }); a.exec(); }
Example output:
starting for 32 items "diagerr.xml" 1 32 "comsetup.log" 2 32 "bootstat.dat" 3 32 "bfsvc.exe" 4 32
Then the application hangs forever (above, the output should count to 32 and stop).