Chromium Code Reviews| Index: ash/wm/workspace/frame_maximize_button.cc |
| diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc |
| index 89297c5d76be29b2e73ba657faa2e1a32055fc1e..e7fc9ead2081972d2c427cd03a51866fd843dd04 100644 |
| --- a/ash/wm/workspace/frame_maximize_button.cc |
| +++ b/ash/wm/workspace/frame_maximize_button.cc |
| @@ -113,6 +113,9 @@ FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, |
| } |
| FrameMaximizeButton::~FrameMaximizeButton() { |
| + // Before the window gets destroyed, the maximizer dialog needs to be shut |
| + // down since it would otherwise call into a deleted object. |
| + maximizer_.reset(); |
| if (window_) |
| OnWindowDestroying(window_); |
| } |
| @@ -151,13 +154,12 @@ void FrameMaximizeButton::SnapButtonHovered(SnapType type) { |
| void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) { |
| DCHECK_NE(snap_type_, SNAP_NONE); |
| + Cancel(true); |
| + // Tell our menu to close. |
| + maximizer_.reset(); |
| snap_type_ = snap_type; |
| Snap(); |
| - // Remove any pending snap previews. |
| - SnapButtonHovered(SNAP_NONE); |
| - // At this point the operation has been performed and the menu should be |
| - // closed - if not, it'll get now closed. |
| - maximizer_.reset(); |
| + // Note: |this| might now be destroyed. |
| } |
| void FrameMaximizeButton::DestroyMaximizeMenu() { |
| @@ -330,9 +332,9 @@ void FrameMaximizeButton::Cancel(bool keep_menu_open) { |
| maximizer_.reset(); |
| UninstallEventFilter(); |
| is_snap_enabled_ = false; |
| + snap_sizer_.reset(); |
|
sky
2012/08/08 04:39:17
Persisting the snap_sizer_ makes me nervous. In pa
Mr4D (OOO till 08-26)
2012/08/08 14:26:46
When doing the change I thought the same thing - b
|
| } |
| phantom_window_.reset(); |
| - snap_sizer_.reset(); |
| snap_type_ = SNAP_NONE; |
| update_timer_.Stop(); |
| SchedulePaint(); |