mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Synchronized Achievement Window
Expanded the use of the lock mutex already used for loading the player's existing unlock status to guard against races involving the Achievements dialog window reading from data AchievementManager might be in the process of updating. The lock has been exposed publicly and the AchievementsWindow uses it in its UpdateData method, and anywhere else that might modify data used to render that window has also been wrapped with it.
This commit is contained in:
@ -4,6 +4,8 @@
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
@ -60,11 +62,14 @@ void AchievementsWindow::ConnectWidgets()
|
||||
|
||||
void AchievementsWindow::UpdateData()
|
||||
{
|
||||
m_header_widget->UpdateData();
|
||||
m_header_widget->setVisible(AchievementManager::GetInstance()->IsLoggedIn());
|
||||
// Settings tab handles its own updates ... indeed, that calls this
|
||||
m_progress_widget->UpdateData();
|
||||
m_tab_widget->setTabVisible(1, AchievementManager::GetInstance()->IsGameLoaded());
|
||||
{
|
||||
std::lock_guard lg{*AchievementManager::GetInstance()->GetLock()};
|
||||
m_header_widget->UpdateData();
|
||||
m_header_widget->setVisible(AchievementManager::GetInstance()->IsLoggedIn());
|
||||
// Settings tab handles its own updates ... indeed, that calls this
|
||||
m_progress_widget->UpdateData();
|
||||
m_tab_widget->setTabVisible(1, AchievementManager::GetInstance()->IsGameLoaded());
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user