mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
!38098 DetachFromMainTree中Crash问题修复
Merge pull request !38098 from 向首兴/DetachFromMainTreeUaf
This commit is contained in:
commit
3763d03dd4
@ -203,6 +203,10 @@ std::list<RefPtr<UINode>>::iterator UINode::RemoveChild(const RefPtr<UINode>& ch
|
||||
AddDisappearingChild(child, std::distance(children_.begin(), iter));
|
||||
}
|
||||
MarkNeedSyncRenderTree(true);
|
||||
if (isTraversing_) {
|
||||
LOGF("Try to remove the child([%{public}s][%{public}d]) of node [%{public}s][%{public}d] when its children "
|
||||
"is traversing", (*iter)->GetTag().c_str(), (*iter)->GetId(), GetTag().c_str(), GetId());
|
||||
}
|
||||
auto result = children_.erase(iter);
|
||||
return result;
|
||||
}
|
||||
@ -554,9 +558,11 @@ void UINode::DetachFromMainTree(bool recursive)
|
||||
OnDetachFromMainTree(recursive);
|
||||
// if recursive = false, recursively call DetachFromMainTree(false), until we reach the first FrameNode.
|
||||
bool isRecursive = recursive || AceType::InstanceOf<FrameNode>(this);
|
||||
isTraversing_ = true;
|
||||
for (const auto& child : GetChildren()) {
|
||||
child->DetachFromMainTree(isRecursive);
|
||||
}
|
||||
isTraversing_ = false;
|
||||
}
|
||||
|
||||
void UINode::ProcessOffscreenTask(bool recursive)
|
||||
|
@ -828,6 +828,7 @@ private:
|
||||
bool isBuildByJS_ = false;
|
||||
bool isRootBuilderNode_ = false;
|
||||
bool isArkTsFrameNode_ = false;
|
||||
bool isTraversing_ = false;
|
||||
NodeStatus nodeStatus_ = NodeStatus::NORMAL_NODE;
|
||||
RootNodeType rootNodeType_ = RootNodeType::PAGE_ETS_TAG;
|
||||
RefPtr<ExportTextureInfo> exportTextureInfo_;
|
||||
|
Loading…
Reference in New Issue
Block a user