Skip to content

Commit

Permalink
[Backport] Security bug 1192552
Browse files Browse the repository at this point in the history
Manual backport of patch originally reviewed on
https://chromium-review.googlesource.com/c/chromium/src/+/2826321:
[views] Handle window deletion during HandleDisplayChange.

In principle there is no reason why the HWNDMessageHandler shouldn't be
deleted by a HandleDisplayChange() call out to the delegate, e.g. if the
change results in a change in window layout.

(cherry picked from commit 299155e5e37a77670b7969771e09e9a16b1f5612)

Bug: 1192552
Change-Id: I9fca35ff32e7037c6492f4cee7069e272059b920
Auto-Submit: Wez <[email protected]>
Commit-Queue: Scott Violet <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#869603}
Cr-Commit-Position: refs/branch-heads/4430@{#1291}
Cr-Branched-From: e5ce7dc4f7518237b3d9bb93cccca35d25216cbe-refs/heads/master@{#857950}
Reviewed-by: Allan Sandfeld Jensen <[email protected]>
  • Loading branch information
Wez authored and mibrunin committed May 7, 2021
1 parent fd48fe2 commit 68da9a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chromium/ui/views/win/hwnd_message_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,13 @@ void HWNDMessageHandler::OnDestroy() {

void HWNDMessageHandler::OnDisplayChange(UINT bits_per_pixel,
const gfx::Size& screen_size) {
base::WeakPtr<HWNDMessageHandler> ref(msg_handler_weak_factory_.GetWeakPtr());
delegate_->HandleDisplayChange();

// HandleDisplayChange() may result in |this| being deleted.
if (!ref)
return;

// Force a WM_NCCALCSIZE to occur to ensure that we handle auto hide
// taskbars correctly.
SendFrameChanged();
Expand Down

0 comments on commit 68da9a7

Please sign in to comment.