Skip to content

Commit

Permalink
[Merge to M110] Tooltip/Exo: Null check root_surface() before OnToolt…
Browse files Browse the repository at this point in the history
…ipShown/Hidden

This CL fixes the crash caused by exo::Surface::observers_ being null.
Surface may be set to null by ShellSurfaceBase::OnSurfaceDestroying
while the observer is still alive, so we need to run null check for
OnTooltipShown/Hidden.

(cherry picked from commit 0a32b09)

Bug: 1403331
Change-Id: I1032032070db952a37de5739dac5cfe55cb8cf65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4123196
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Eriko Kurimoto <elkurin@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1086647}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4122378
Cr-Commit-Position: refs/branch-heads/5481@{#217}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
elkurin authored and Chromium LUCI CQ committed Jan 12, 2023
1 parent b355789 commit 8b497a2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/exo/shell_surface_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1306,11 +1306,15 @@ void ShellSurfaceBase::OnWindowActivated(ActivationReason reason,
void ShellSurfaceBase::OnTooltipShown(aura::Window* target,
const std::u16string& text,
const gfx::Rect& bounds) {
root_surface()->OnTooltipShown(text, bounds);
if (root_surface()) {
root_surface()->OnTooltipShown(text, bounds);
}
}

void ShellSurfaceBase::OnTooltipHidden(aura::Window* target) {
root_surface()->OnTooltipHidden();
if (root_surface()) {
root_surface()->OnTooltipHidden();
}
}

// Returns true if surface is currently being resized.
Expand Down

0 comments on commit 8b497a2

Please sign in to comment.