mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Fixing minor data race and memory issues in Placefile Manager
This commit is contained in:
parent
80c307c5fc
commit
c7487281ad
1 changed files with 3 additions and 2 deletions
|
|
@ -277,7 +277,7 @@ void PlacefileManager::set_placefile_url(const std::string& name,
|
||||||
placefileRecord->name_ = normalizedUrl;
|
placefileRecord->name_ = normalizedUrl;
|
||||||
placefileRecord->placefile_ = nullptr;
|
placefileRecord->placefile_ = nullptr;
|
||||||
p->placefileRecordMap_.erase(it);
|
p->placefileRecordMap_.erase(it);
|
||||||
p->placefileRecordMap_.emplace(normalizedUrl, placefileRecord);
|
p->placefileRecordMap_.insert_or_assign(normalizedUrl, placefileRecord);
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
|
@ -413,7 +413,7 @@ PlacefileManager::GetActivePlacefiles()
|
||||||
{
|
{
|
||||||
if (record->enabled_ && record->placefile_ != nullptr)
|
if (record->enabled_ && record->placefile_ != nullptr)
|
||||||
{
|
{
|
||||||
placefiles.emplace_back(record->placefile_);
|
placefiles.push_back(record->placefile_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -695,6 +695,7 @@ void PlacefileManager::Impl::PlacefileRecord::ScheduleRefresh()
|
||||||
|
|
||||||
void PlacefileManager::Impl::PlacefileRecord::CancelRefresh()
|
void PlacefileManager::Impl::PlacefileRecord::CancelRefresh()
|
||||||
{
|
{
|
||||||
|
std::unique_lock lock {timerMutex_};
|
||||||
refreshTimer_.cancel();
|
refreshTimer_.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue