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

Unified Diff: ash/wm/workspace/frame_maximize_button.cc

Issue 10829226: Fixing many problems around the maximize bubble (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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: 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..8ce51d47c1c4505f8ced3b4e463c3e2c35d032e2 100644
--- a/ash/wm/workspace/frame_maximize_button.cc
+++ b/ash/wm/workspace/frame_maximize_button.cc
@@ -113,6 +113,7 @@ FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener,
}
FrameMaximizeButton::~FrameMaximizeButton() {
+ maximizer_.reset();
sky 2012/08/07 23:11:18 Add a comment as to why this needs to be first.
Mr4D (OOO till 08-26) 2012/08/08 01:02:28 Done.
if (window_)
OnWindowDestroying(window_);
}
@@ -151,13 +152,24 @@ void FrameMaximizeButton::SnapButtonHovered(SnapType type) {
void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) {
DCHECK_NE(snap_type_, SNAP_NONE);
- snap_type_ = snap_type;
- Snap();
+ // SNAP_MINIMIZE might destroy |this| for windows like the file manager.
sky 2012/08/07 23:11:18 This is too fragile. Can't the code be like Proces
Mr4D (OOO till 08-26) 2012/08/08 01:02:28 Okay. Changed it. However - I did not move the cas
+ // To avoid crashes we have therefore to execute that command at the end.
+ // All other commands need the snap_sizer to know the target size, so they
+ // have to be executed before we start destroying the rest.
+ if (snap_type != SNAP_MINIMIZE) {
+ 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();
+ if (snap_type == SNAP_MINIMIZE) {
+ snap_type_ = snap_type;
+ Snap();
+ // |this| might now be destroyed.
+ }
}
void FrameMaximizeButton::DestroyMaximizeMenu() {

Powered by Google App Engine
This is Rietveld 408576698