Index: chrome/browser/ui/panels/panel_manager.cc |
diff --git a/chrome/browser/ui/panels/panel_manager.cc b/chrome/browser/ui/panels/panel_manager.cc |
index f19422f421e2794e6e22cb5f5dd5deae694629e0..4374a72a6d28446681d514bc24a44a55e60842a3 100644 |
--- a/chrome/browser/ui/panels/panel_manager.cc |
+++ b/chrome/browser/ui/panels/panel_manager.cc |
@@ -28,9 +28,6 @@ const int kPanelDefaultHeightPixels = 290; |
const double kPanelMaxWidthFactor = 1.0; |
const double kPanelMaxHeightFactor = 0.5; |
-// Horizontal spacing between two panels. |
-const int kPanelsHorizontalSpacing = 4; |
- |
// Single instance of PanelManager. |
scoped_ptr<PanelManager> panel_instance; |
} // namespace |
@@ -351,9 +348,12 @@ void PanelManager::RemoveAll() { |
// This should not be called when we're in the process of dragging. |
DCHECK(dragging_panel_index_ == kInvalidPanelIndex); |
+ // Make a copy of the iterator as closing panels can modify the vector. |
+ Panels panels_copy = panels_; |
+ |
// Start from the bottom to avoid reshuffling. |
- for (Panels::reverse_iterator iter = panels_.rbegin(); |
- iter != panels_.rend(); ++iter) |
+ for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
+ iter != panels_copy.rend(); ++iter) |
(*iter)->Close(); |
} |