diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e16e332543..a8fb97308a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -36,6 +36,7 @@ Since last release * Removed unnecessary records being added to the Resource database by packaging process (#1761) * Removed GTest source code from code coverage reports (#1759) * Updated action versions to avoid node.js deprecation (#1802) +* ResTracker Extract gave the wrong parent_id to one of the child resources (#1806) v1.6.0 diff --git a/src/res_tracker.cc b/src/res_tracker.cc index 244c497558..02957bec94 100644 --- a/src/res_tracker.cc +++ b/src/res_tracker.cc @@ -46,18 +46,20 @@ void ResTracker::Extract(ResTracker* removed) { return; } + // removed parent must be set before the resource is recorded, otherwise + // removed ends up with parent1 of the other child (which is this resource + // after being bumped) + removed->parent1_ = res_->state_id(); + removed->parent2_ = 0; + removed->tracked_ = tracked_; + removed->Record(); + if (res_->quantity() > eps_rsrc()) { parent1_ = res_->state_id(); parent2_ = 0; Record(); } - - removed->parent1_ = res_->state_id(); - removed->parent2_ = 0; - removed->tracked_ = tracked_; - - removed->Record(); } void ResTracker::Absorb(ResTracker* absorbed) {