Fix dangling pointer in MouseWatcherViewHost.
This CL fixes an unretained dangling pointer detected in `WindowTreeHostManagerTest` and removes the `DanglingUntriaged` annotation from `MouseWatcherViewHost`. Bug: 40277363 Change-Id: I021539086af9a3e2e8cc05ac48f4a0a385930e00 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5649800 Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Reviewed-by: Weidong Liu <weidongliu@chromium.org> Reviewed-by: Allen Bauer <kylixrd@chromium.org> Commit-Queue: Weidong Liu <weidongliu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1319631}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
cc856b69d2
commit
e662708ee9
@ -2151,17 +2151,17 @@ TEST_F(WindowTreeHostManagerTest,
|
||||
widget->Show();
|
||||
|
||||
TestMouseWatcherListener listener;
|
||||
views::MouseWatcher watcher(
|
||||
auto watcher = std::make_unique<views::MouseWatcher>(
|
||||
std::make_unique<views::MouseWatcherViewHost>(view, gfx::Insets()),
|
||||
&listener);
|
||||
watcher.Start(root2);
|
||||
watcher->Start(root2);
|
||||
|
||||
ui::test::EventGenerator event_generator(
|
||||
widget->GetNativeWindow()->GetRootWindow());
|
||||
event_generator.MoveMouseToCenterOf(widget->GetNativeWindow());
|
||||
|
||||
UpdateDisplay("400x300");
|
||||
watcher.Stop();
|
||||
watcher.reset();
|
||||
|
||||
widget->CloseNow();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class VIEWS_EXPORT MouseWatcherViewHost : public MouseWatcherHost {
|
||||
bool IsMouseOverWindow();
|
||||
|
||||
// View we're listening for events over.
|
||||
const raw_ptr<const View, DanglingUntriaged> view_;
|
||||
const raw_ptr<const View> view_;
|
||||
// Insets added to the bounds of the view.
|
||||
const gfx::Insets hot_zone_insets_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user