From: Donna Dionne Date: Fri, 28 Aug 2020 18:35:40 +0000 (-0700) Subject: [PATCH] Fixing a member var to not be a reference. (backport to v1.30.x) X-Git-Tag: archive/raspbian/1.30.2-3+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9fe089106e931ceca97046b9697a952962035e86;p=grpc.git [PATCH] Fixing a member var to not be a reference. (backport to v1.30.x) Gbp-Pq: Name 17-fixing_a_member_var_to_not_be_a_reference.patch --- diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc index ea1007cb..effcf2e2 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc @@ -179,7 +179,7 @@ class XdsRoutingLb : public LoadBalancingPolicy { RefCountedPtr xds_routing_policy_; // Points to the corresponding key in XdsRoutingLb::actions_. - const std::string& name_; + const std::string name_; OrphanablePtr child_policy_; @@ -294,9 +294,10 @@ void XdsRoutingLb::UpdateLocked(UpdateArgs args) { const RefCountedPtr& config = p.second; auto it = actions_.find(name); if (it == actions_.end()) { - it = actions_.emplace(std::make_pair(name, nullptr)).first; - it->second = MakeOrphanable( - Ref(DEBUG_LOCATION, "XdsRoutingChild"), it->first); + it = actions_ + .emplace(name, MakeOrphanable( + Ref(DEBUG_LOCATION, "XdsRoutingChild"), name)) + .first; } it->second->UpdateLocked(config, args.addresses, args.args); }