Skip to content

Commit

Permalink
ResTracker Extract gave the wrong parent_id to one of the child resou…
Browse files Browse the repository at this point in the history
…rces
  • Loading branch information
nuclearkatie committed Sep 20, 2024
1 parent 3760e52 commit ac41773
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/res_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ac41773

Please sign in to comment.