[PictureLoader] Fix double-queueing bug (#6014)

This commit is contained in:
RickyRister 2025-07-02 20:08:31 -07:00 committed by GitHub
parent c57b84cb17
commit ed82106359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -67,8 +67,7 @@ void PictureLoaderWorker::queueRequest(const QUrl &url, PictureLoaderWorkerWork
QUrl cachedRedirect = getCachedRedirect(url);
if (!cachedRedirect.isEmpty()) {
queueRequest(cachedRedirect, worker);
}
if (cache->metaData(url).isValid()) {
} else if (cache->metaData(url).isValid()) {
makeRequest(url, worker);
} else {
requestLoadQueue.append(qMakePair(url, worker));

View file

@ -194,10 +194,7 @@ QImage PictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply)
void PictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
{
emit imageLoaded(cardToDownload.getCard(), image);
// Delayed delete is a dumb hack to prevent segfaults due to calling methods on a deleted Work
// TODO: find a more proper way to structure this whole thing
QTimer::singleShot(2000, this, &QObject::deleteLater);
deleteLater();
}
void PictureLoaderWorkerWork::picDownloadChanged()