mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 17:32:17 -07:00
[PictureLoader] Guard cache teardown and stop blocking the UI thread
This commit is contained in:
parent
ad75153e0f
commit
e960471c69
7 changed files with 64 additions and 34 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue