Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 533e8cc3 authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi
Browse files

[res] Fix the bag resolution stack

Two different cache containers are tightly linked together, and
clearing only one of them breaks the expected link.

Test: build + atest android.view.cts.ViewAttributeTest
Bug: 282267185
Change-Id: I713aec60c02d559d8435e2f4a640718b21b1b45b
parent 09144887
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1122,9 +1122,7 @@ base::expected<const ResolvedBag*, NullOrIOError> AssetManager2::ResolveBag(

base::expected<const ResolvedBag*, NullOrIOError> AssetManager2::GetBag(uint32_t resid) const {
  auto resid_stacks_it = cached_bag_resid_stacks_.find(resid);
  if (resid_stacks_it != cached_bag_resid_stacks_.end()) {
    resid_stacks_it->second.clear();
  } else {
  if (resid_stacks_it == cached_bag_resid_stacks_.end()) {
    resid_stacks_it = cached_bag_resid_stacks_.emplace(resid, std::vector<uint32_t>{}).first;
  }
  const auto bag = GetBag(resid, resid_stacks_it->second);