diff --git a/dom/src/dom/dom_node.cc b/dom/src/dom/dom_node.cc index 97abf0bb850..777e4d48a91 100644 --- a/dom/src/dom/dom_node.cc +++ b/dom/src/dom/dom_node.cc @@ -103,13 +103,13 @@ std::shared_ptr DomNode::GetChildAt(size_t index) { } int32_t DomNode::AddChildByRefInfo(const std::shared_ptr& dom_info) { - std::shared_ptr ref_info = dom_info->ref_info; + std::shared_ptr& ref_info = dom_info->ref_info; if (ref_info) { if (children_.size() == 0) { children_.push_back(dom_info->dom_node); } else { for (uint32_t i = 0; i < children_.size(); ++i) { - auto child = children_[i]; + auto& child = children_[i]; if (ref_info->ref_id == child->GetId()) { if (ref_info->relative_to_ref == RelativeType::kFront) { children_.insert( @@ -145,7 +145,7 @@ int32_t DomNode::AddChildByRefInfo(const std::shared_ptr& dom_info) { int32_t DomNode::GetChildIndex(uint32_t id) { int32_t index = -1; for (uint32_t i = 0; i < children_.size(); ++i) { - auto child = children_[i]; + auto& child = children_[i]; if (child && child->GetId() == id) { index = static_cast(i); break; diff --git a/dom/src/dom/root_node.cc b/dom/src/dom/root_node.cc index 31059bcf9bf..4963c0f2bbf 100644 --- a/dom/src/dom/root_node.cc +++ b/dom/src/dom/root_node.cc @@ -74,7 +74,7 @@ void RootNode::CreateDomNodes(std::vector>&& nodes) { } std::vector> nodes_to_create; for (const auto& node_info : nodes) { - auto node = node_info->dom_node; + auto& node = node_info->dom_node; std::shared_ptr parent_node = GetNode(node->GetPid()); if (parent_node == nullptr) { continue;