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

Unified Diff: components/mus/ws/display_manager.cc

Issue 1801963002: Change primordial pipes to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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: components/mus/ws/display_manager.cc
diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc
index b5dbb0953a20e1de6910c3855c59cdaa4a4f16ec..15a91609f906d549bc1abf84f93de35330e46ce8 100644
--- a/components/mus/ws/display_manager.cc
+++ b/components/mus/ws/display_manager.cc
@@ -41,13 +41,19 @@ void DisplayManager::AddDisplay(Display* display) {
void DisplayManager::DestroyDisplay(Display* display) {
if (pending_displays_.count(display)) {
pending_displays_.erase(display);
- } else {
+ } else if (displays_.count(display)) {
for (const auto& pair : user_display_managers_)
pair.second->OnWillDestroyDisplay(display);
-
- DCHECK(displays_.count(display));
displays_.erase(display);
+ } else {
+ // NOTE: This may fuction may be re-entered with the same |display| in which
+ // case we need to avoid a double-free. This should probably be considered a
+ // bug. This was hidden before due to the fact that the mus app exited
+ // uncleanly in tests.
+ DLOG(WARNING) << "Trying to destroy the same display twice.";
+ return;
}
+
delete display;
// If we have no more roots left, let the app know so it can terminate.

Powered by Google App Engine
This is Rietveld 408576698