Skip to content

Commit

Permalink
Fix crash when terminating pre-launched Lacros, if already terminated
Browse files Browse the repository at this point in the history
Other calls to Terminate inside BrowserManager always check that
lacros_process_ is valid before terminating it. Not doing so may
result in timing issues in which Ash (and pre-launched Lacros) is
terminated before we get into ResumeLaunch, causing a crash.

Bug: 1446157
Change-Id: I1110e1209d0c17a02b4bb5114cf24bad2fe9f740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4569945
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Andrea Orru <andreaorru@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150164}
  • Loading branch information
Andrea Orru authored and Chromium LUCI CQ committed May 29, 2023
1 parent 7b67059 commit 2c5fadc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chrome/browser/ash/crosapi/browser_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,9 @@ void BrowserManager::ResumeLaunch() {
LOG(WARNING) << "Lacros is not enabled for the current user. Terminating "
"pre-launched instance";
unload_requested_ = true;
lacros_process_.Terminate(/*exit_code=*/0, /*wait=*/false);
if (lacros_process_.IsValid()) {
lacros_process_.Terminate(/*exit_code=*/0, /*wait=*/false);
}
return;
}

Expand Down

0 comments on commit 2c5fadc

Please sign in to comment.