[PictureLoader] Guard cache teardown and stop blocking the UI thread

This commit is contained in:
Lukas Brübach 2026-09-18 04:42:31 +02:00
parent ad75153e0f
commit e960471c69
7 changed files with 64 additions and 34 deletions

View file

@ -181,9 +181,14 @@ StorageSettingsPage::StorageSettingsPage()
void StorageSettingsPage::clearDownloadedPicsButtonClicked()
{
CardPictureLoader::clearNetworkCache();
// The network cache is cleared asynchronously on the worker thread, so wait for the completion
// signal before confirming; the in-memory pixmap cache is cleared synchronously right away.
connect(
&CardPictureLoader::getInstance(), &CardPictureLoader::networkCacheCleared, this,
[this] { QMessageBox::information(this, tr("Success"), tr("Cached card pictures have been reset.")); },
Qt::SingleShotConnection);
CardPictureLoader::clearPixmapCache();
QMessageBox::information(this, tr("Success"), tr("Cached card pictures have been reset."));
CardPictureLoader::clearNetworkCache();
}
void StorageSettingsPage::clearImageBackupsButtonClicked()