GUI: Improve thread-safety for icons set access

The previous commit was not sufficient as getIconsSet() returns a
reference to the SearchSet and it could then be used after the
mutex had been unlocked and while it was being modified in
initIconsSet() called in another thread.
This commit is contained in:
Thierry Crozat 2022-06-29 19:27:27 +01:00 committed by Eugene Sandulenko
parent 8cda1fe870
commit b248add106
3 changed files with 10 additions and 4 deletions

View file

@ -183,6 +183,7 @@ LauncherDialog::LauncherDialog(const Common::String &dialogName, LauncherChooser
Common::ArchiveMemberList mdFiles;
g_gui.lockIconsSet();
g_gui.getIconsSet().listMatchingMembers(mdFiles, "*.xml");
for (Common::ArchiveMemberList::iterator md = mdFiles.begin(); md != mdFiles.end(); ++md) {
if (_metadataParser.loadStream((*md)->createReadStream()) == false) {
@ -194,6 +195,7 @@ LauncherDialog::LauncherDialog(const Common::String &dialogName, LauncherChooser
}
_metadataParser.close();
}
g_gui.unlockIconsSet();
}
LauncherDialog::~LauncherDialog() {