Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Unified Diff: ui/display/manager/chromeos/display_change_observer.cc

Issue 2571543002: Fix use after free for cached_displays_. (Closed)
Patch Set: Add invalidate to tests. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/display/manager/chromeos/display_configurator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/manager/chromeos/display_change_observer.cc
diff --git a/ui/display/manager/chromeos/display_change_observer.cc b/ui/display/manager/chromeos/display_change_observer.cc
index 150db3892bbbf6c3e0349c5cfe5acfb2dd5aa596..f9e058a7a93fa45c7f44d1977457e044b713bd00 100644
--- a/ui/display/manager/chromeos/display_change_observer.cc
+++ b/ui/display/manager/chromeos/display_change_observer.cc
@@ -288,7 +288,16 @@ void DisplayChangeObserver::OnDisplayModeChangeFailed(
}
void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() {
- OnDisplayModeChanged(display_configurator_->cached_displays());
+ // If there are no cached display snapshots, either there are no attached
+ // displays or the cached snapshots have been invalidated. For the first case
+ // there aren't any touchscreens to associate. For the second case, the
+ // displays and touch input-devices will get associated when display
+ // configuration finishes.
+ const auto& cached_displays = display_configurator_->cached_displays();
+ if (!cached_displays.empty())
+ OnDisplayModeChanged(cached_displays);
+ else
+ VLOG(1) << "Not updating touchscreen associations";
}
// static
« no previous file with comments | « no previous file | ui/display/manager/chromeos/display_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698