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

Unified Diff: ui/display/manager/chromeos/display_configurator.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
Index: ui/display/manager/chromeos/display_configurator.cc
diff --git a/ui/display/manager/chromeos/display_configurator.cc b/ui/display/manager/chromeos/display_configurator.cc
index 8258d23d29eaddcb40e5c3807cd4e73e448b1dce..39a3f6ef751fce0efe4dc1e4acbb0584f6ec7617 100644
--- a/ui/display/manager/chromeos/display_configurator.cc
+++ b/ui/display/manager/chromeos/display_configurator.cc
@@ -524,10 +524,10 @@ void DisplayConfigurator::Init(
// If the delegate is already initialized don't update it (For example, tests
// set their own delegates).
- if (!native_display_delegate_) {
+ if (!native_display_delegate_)
native_display_delegate_ = std::move(display_delegate);
- native_display_delegate_->AddObserver(this);
- }
+
+ native_display_delegate_->AddObserver(this);
}
void DisplayConfigurator::TakeControl(const DisplayControlCallback& callback) {
@@ -947,6 +947,11 @@ void DisplayConfigurator::OnConfigurationChanged() {
this, &DisplayConfigurator::ConfigureDisplays);
}
+void DisplayConfigurator::OnDisplaySnapshotsInvalidated() {
+ VLOG(1) << "Display snapshots invalidated.";
+ cached_displays_.clear();
+}
+
void DisplayConfigurator::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
« no previous file with comments | « ui/display/manager/chromeos/display_configurator.h ('k') | ui/display/manager/chromeos/test/test_native_display_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698