mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-02 03:23:56 -07:00
[PictureLoader] Fix double-queueing bug (#6014)
This commit is contained in:
parent
c57b84cb17
commit
ed82106359
2 changed files with 2 additions and 6 deletions
|
|
@ -67,8 +67,7 @@ void PictureLoaderWorker::queueRequest(const QUrl &url, PictureLoaderWorkerWork
|
||||||
QUrl cachedRedirect = getCachedRedirect(url);
|
QUrl cachedRedirect = getCachedRedirect(url);
|
||||||
if (!cachedRedirect.isEmpty()) {
|
if (!cachedRedirect.isEmpty()) {
|
||||||
queueRequest(cachedRedirect, worker);
|
queueRequest(cachedRedirect, worker);
|
||||||
}
|
} else if (cache->metaData(url).isValid()) {
|
||||||
if (cache->metaData(url).isValid()) {
|
|
||||||
makeRequest(url, worker);
|
makeRequest(url, worker);
|
||||||
} else {
|
} else {
|
||||||
requestLoadQueue.append(qMakePair(url, worker));
|
requestLoadQueue.append(qMakePair(url, worker));
|
||||||
|
|
|
||||||
|
|
@ -194,10 +194,7 @@ QImage PictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply)
|
||||||
void PictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
|
void PictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
|
||||||
{
|
{
|
||||||
emit imageLoaded(cardToDownload.getCard(), image);
|
emit imageLoaded(cardToDownload.getCard(), image);
|
||||||
|
deleteLater();
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureLoaderWorkerWork::picDownloadChanged()
|
void PictureLoaderWorkerWork::picDownloadChanged()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue