[PATCH] Fixing a member var to not be a reference. (backport to v1.30.x)
authorDonna Dionne <donnadionne@google.com>
Fri, 28 Aug 2020 18:35:40 +0000 (11:35 -0700)
committerLaszlo Boszormenyi (GCS) <gcs@debian.org>
Thu, 4 Feb 2021 09:44:30 +0000 (09:44 +0000)
Gbp-Pq: Name 17-fixing_a_member_var_to_not_be_a_reference.patch

src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc

index ea1007cb90cdeeb02884434127698137726b7fd2..effcf2e2cf08f58104bf24ddbbfc954bf446fd8c 100644 (file)
@@ -179,7 +179,7 @@ class XdsRoutingLb : public LoadBalancingPolicy {
     RefCountedPtr<XdsRoutingLb> xds_routing_policy_;
 
     // Points to the corresponding key in XdsRoutingLb::actions_.
-    const std::string& name_;
+    const std::string name_;
 
     OrphanablePtr<LoadBalancingPolicy> child_policy_;
 
@@ -294,9 +294,10 @@ void XdsRoutingLb::UpdateLocked(UpdateArgs args) {
     const RefCountedPtr<LoadBalancingPolicy::Config>& config = p.second;
     auto it = actions_.find(name);
     if (it == actions_.end()) {
-      it = actions_.emplace(std::make_pair(name, nullptr)).first;
-      it->second = MakeOrphanable<XdsRoutingChild>(
-          Ref(DEBUG_LOCATION, "XdsRoutingChild"), it->first);
+      it = actions_
+               .emplace(name, MakeOrphanable<XdsRoutingChild>(
+                                  Ref(DEBUG_LOCATION, "XdsRoutingChild"), name))
+               .first;
     }
     it->second->UpdateLocked(config, args.addresses, args.args);
   }