| Index: ash/monitor/monitor_controller.cc
|
| diff --git a/ash/monitor/monitor_controller.cc b/ash/monitor/monitor_controller.cc
|
| index 397e5abb1f65f2414046aac49b6392d892909922..9574c9d25a120901a681ca73e5aef5b1345614ec 100644
|
| --- a/ash/monitor/monitor_controller.cc
|
| +++ b/ash/monitor/monitor_controller.cc
|
| @@ -58,6 +58,11 @@ void MonitorController::OnMonitorBoundsChanged(const aura::Monitor* monitor) {
|
| }
|
|
|
| void MonitorController::OnMonitorAdded(aura::Monitor* monitor) {
|
| + if (root_windows_.empty()) {
|
| + root_windows_[monitor] = Shell::GetRootWindow();
|
| + Shell::GetRootWindow()->SetHostBounds(monitor->bounds());
|
| + return;
|
| + }
|
| aura::RootWindow* root = aura::Env::GetInstance()->monitor_manager()->
|
| CreateRootWindowForMonitor(monitor);
|
| root_windows_[monitor] = root;
|
| @@ -66,8 +71,13 @@ void MonitorController::OnMonitorAdded(aura::Monitor* monitor) {
|
|
|
| void MonitorController::OnMonitorRemoved(const aura::Monitor* monitor) {
|
| aura::RootWindow* root = root_windows_[monitor];
|
| - root_windows_.erase(monitor);
|
| - delete root;
|
| + DCHECK(root);
|
| + // Monitor for root window will be deleted when the Primary RootWindow
|
| + // is deleted by the Shell.
|
| + if (root != Shell::GetRootWindow()) {
|
| + root_windows_.erase(monitor);
|
| + delete root;
|
| + }
|
| }
|
|
|
| void MonitorController::Init() {
|
|
|