修复并发赋值liveCreaseRegion_导致的内存风险

Signed-off-by: peixu <peixu1@huawei.com>
This commit is contained in:
peixu
2026-08-18 23:03:44 +08:00
parent 6b67272e1b
commit b125494ea4
2 changed files with 2 additions and 0 deletions
@@ -96,6 +96,7 @@ private:
FoldCreaseRegion GetFoldCreaseRegion(bool isVertical, bool isNeedReverse) const;
void GetFoldCreaseRect(bool isVertical, bool isNeedReverse, const std::vector<int32_t>& foldRect,
std::vector<DMRect>& foldCreaseRect) const;
mutable std::mutex liveCreaseRegionMutex_;
std::mutex superStatusMutex_;
std::vector<SuperFoldCreaseRegionItem> superFoldCreaseRegionItems_;
@@ -515,6 +515,7 @@ sptr<FoldCreaseRegion> SuperFoldStateManager::GetCurrentFoldCreaseRegion()
FoldCreaseRegion SuperFoldStateManager::GetLiveCreaseRegion()
{
TLOGI(WmsLogTag::DMS, "enter");
std::lock_guard<std::mutex> lock_mode(liveCreaseRegionMutex_);
SuperFoldStatus curFoldState = ScreenSessionManager::GetInstance().GetSuperFoldStatus();
if (curFoldState == SuperFoldStatus::UNKNOWN || curFoldState == SuperFoldStatus::FOLDED) {
return FoldCreaseRegion(0, {});