Merge pull request #23610 from donnadionne/crash

Member variable should not be a reference; causing crash when used in destructor.
reviewable/pr23623/r1
donnadionne 5 years ago committed by GitHub
commit bbb1783fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc

@ -171,7 +171,7 @@ class WeightedTargetLb : public LoadBalancingPolicy {
// The owning LB policy.
RefCountedPtr<WeightedTargetLb> weighted_target_policy_;
const std::string& name_;
const std::string name_;
uint32_t weight_;
@ -290,9 +290,8 @@ void WeightedTargetLb::UpdateLocked(UpdateArgs args) {
const std::string& name = p.first;
auto it = targets_.find(name);
if (it == targets_.end()) {
it = targets_.emplace(std::make_pair(name, nullptr)).first;
it->second = MakeOrphanable<WeightedChild>(
Ref(DEBUG_LOCATION, "WeightedChild"), it->first);
targets_.emplace(name, MakeOrphanable<WeightedChild>(
Ref(DEBUG_LOCATION, "WeightedChild"), name));
}
}
// Update all children.

Loading…
Cancel
Save