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

Side by Side Diff: ui/aura_shell/workspace/workspace_manager.cc

Issue 8395033: Fix crash when deleting workspaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "ui/aura_shell/workspace/workspace_manager.h" 4 #include "ui/aura_shell/workspace/workspace_manager.h"
5 5
6 #include <algorithm> 6 #include <algorithm>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "ui/aura_shell/workspace/workspace.h" 10 #include "ui/aura_shell/workspace/workspace.h"
11 11
12 namespace { 12 namespace {
13 13
14 // The horizontal margein between workspaces in pixels. 14 // The horizontal margein between workspaces in pixels.
15 const int kWorkspaceHorizontalMargin = 50; 15 const int kWorkspaceHorizontalMargin = 50;
16 } 16 }
17 17
18 namespace aura_shell { 18 namespace aura_shell {
19 19
20 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
21 // WindowManager, public: 21 // WindowManager, public:
22 22
23 WorkspaceManager::WorkspaceManager() 23 WorkspaceManager::WorkspaceManager()
24 : active_workspace_(NULL) { 24 : active_workspace_(NULL) {
25 } 25 }
26 26
27 WorkspaceManager::~WorkspaceManager() { 27 WorkspaceManager::~WorkspaceManager() {
28 STLDeleteElements(&workspaces_); 28 std::vector<Workspace*> copy_to_delete(workspaces_);
29 STLDeleteElements(&copy_to_delete);
29 } 30 }
30 31
31 Workspace* WorkspaceManager::CreateWorkspace() { 32 Workspace* WorkspaceManager::CreateWorkspace() {
32 return new Workspace(this); 33 return new Workspace(this);
33 } 34 }
34 35
35 Workspace* WorkspaceManager::GetActiveWorkspace() const { 36 Workspace* WorkspaceManager::GetActiveWorkspace() const {
36 return active_workspace_; 37 return active_workspace_;
37 } 38 }
38 39
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) { 90 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) {
90 DCHECK(std::find(workspaces_.begin(), 91 DCHECK(std::find(workspaces_.begin(),
91 workspaces_.end(), 92 workspaces_.end(),
92 workspace) 93 workspace)
93 != workspaces_.end()); 94 != workspaces_.end());
94 active_workspace_ = workspace; 95 active_workspace_ = workspace;
95 } 96 }
96 97
97 } // namespace aura_shell 98 } // namespace aura_shell
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698