mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-19 09:19:05 +02:00
Make the workqueue slightly safer. Put g_gameInfoCache on the heap.
Cherry-picked from #8592
This commit is contained in:
1 parent
5f761c346b
commit
da1a04be8d
18 files changed
+73
-64
No files matched your search
@@ -45,7 +45,7 @@
|
||||
#define unique_ptr auto_ptr
|
||||
#endif
|
||||
|
||||
GameInfoCache g_gameInfoCache;
|
||||
GameInfoCache *g_gameInfoCache;
|
||||
|
||||
GameInfo::~GameInfo() {
|
||||
delete iconTexture;
|
||||
@@ -583,6 +583,7 @@ handleELF:
|
||||
}
|
||||
info_->pending = false;
|
||||
info_->DisposeFileLoader();
|
||||
// ILOG("Completed writing info for %s", info_->GetTitle().c_str());
|
||||
}
|
||||
|
||||
virtual float priority() {
|
||||
@@ -595,9 +596,13 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(GameInfoWorkItem);
|
||||
};
|
||||
|
||||
GameInfoCache::GameInfoCache() : gameInfoWQ_(nullptr) {
|
||||
Init();
|
||||
}
|
||||
|
||||
GameInfoCache::~GameInfoCache() {
|
||||
Clear();
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void GameInfoCache::Init() {
|
||||
@@ -614,8 +619,10 @@ void GameInfoCache::Shutdown() {
|
||||
}
|
||||
|
||||
void GameInfoCache::Clear() {
|
||||
if (gameInfoWQ_)
|
||||
if (gameInfoWQ_) {
|
||||
gameInfoWQ_->Flush();
|
||||
gameInfoWQ_->WaitUntilDone();
|
||||
}
|
||||
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
|
||||
{
|
||||
lock_guard lock(iter->second->lock);
|
||||
|
||||
Reference in new issue
Block a user