Skip to content

Commit

Permalink
Remove observer properly in ArcPolicyBridge dtor
Browse files Browse the repository at this point in the history
Previous implementation missed a case where ARC on Demand is active but
OnConnectClosed is never reached.

TEST=Manual testing on DUT
BUG=1424573

Change-Id: I1530c59e4066551037b987d0994e69008b2fd062
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4360679
Auto-Submit: Bryan Yu <yuholong@google.com>
Reviewed-by: Yao Li <yaohuali@google.com>
Commit-Queue: Yao Li <yaohuali@google.com>
Cr-Commit-Position: refs/heads/main@{#1121455}
  • Loading branch information
Bryan Yu authored and Chromium LUCI CQ committed Mar 23, 2023
1 parent b5f5bdb commit 5f2a724
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chrome/browser/ash/arc/policy/arc_policy_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ ArcPolicyBridge::ArcPolicyBridge(content::BrowserContext* context,

ArcPolicyBridge::~ArcPolicyBridge() {
VLOG(2) << "ArcPolicyBridge::~ArcPolicyBridge";
if (is_policy_service_observed) {
policy_service_->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this);
is_policy_service_observed = false;
policy_service_ = nullptr;
}
arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get();
// It can be null in unittests
if (arc_session_manager) {
Expand Down

0 comments on commit 5f2a724

Please sign in to comment.