nothread: do not delete reader thread object before it gets used
exec is an empty function on nothread and returns right away, so the pixmap reader thread object gets deleted before it can download the url Task-number: QTBUG-72105 Change-Id: If205dbe12d0b5299b43a68e7d0d955a2b89b4af1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
1b79a40466
commit
48eb8da7f4
|
@ -471,6 +471,10 @@ QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng)
|
|||
eventLoopQuitHack->moveToThread(this);
|
||||
connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection);
|
||||
start(QThread::LowestPriority);
|
||||
#if !QT_CONFIG(thread)
|
||||
// call nonblocking run ourself, as nothread qthread does not
|
||||
run();
|
||||
#endif
|
||||
}
|
||||
|
||||
QQuickPixmapReader::~QQuickPixmapReader()
|
||||
|
@ -948,8 +952,11 @@ void QQuickPixmapReader::run()
|
|||
processJobs();
|
||||
exec();
|
||||
|
||||
#if QT_CONFIG(thread)
|
||||
// nothread exec is empty and returns
|
||||
delete threadObject;
|
||||
threadObject = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
class QQuickPixmapKey
|
||||
|
|
Loading…
Reference in New Issue