Commit ab4e21b7 authored by yusukes's avatar yusukes Committed by Commit bot

arc: Fix crash in arc_process_task.cc during browser shutdown

Since TaskManagerImpl is destructed after ~ArcServiceManager is called,
we need to check the return value from the getter.

BUG=680301
TEST=1) try, 2) sign in, wait for ARC boot, press Search+ESC,
 press Ctrl+Shift+QQ to sign out, confirm the browser does not crash

Review-Url: https://codereview.chromium.org/2625823005
Cr-Commit-Position: refs/heads/master@{#443304}
parent caf312f6
......@@ -113,10 +113,14 @@ void ArcProcessTask::StartIconLoading() {
}
ArcProcessTask::~ArcProcessTask() {
arc::ArcServiceManager::Get()
->arc_bridge_service()
->intent_helper()
->RemoveObserver(this);
auto* service_manager = arc::ArcServiceManager::Get();
// This destructor can also be called when TaskManagerImpl is destructed.
// Since TaskManagerImpl is a LAZY_INSTANCE, arc::ArcServiceManager may have
// already been destructed. In that case, arc_bridge_service() has also been
// destructed, and it is safe to just return.
if (!service_manager)
return;
service_manager->arc_bridge_service()->intent_helper()->RemoveObserver(this);
}
Task::Type ArcProcessTask::GetType() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment