diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2011-04-14 19:30:15 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2011-04-14 19:30:15 +0000 |
commit | e27ef9a94628853e1ab7dd9cf7ac883d96596dda (patch) | |
tree | 73d534c29fef865f1ec46793154d016a074ba024 /AppKit | |
parent | 09c3d1d4c6cc035acec7578eeb0ba0bae228fcb0 (diff) |
[Author: thakis]
Make implicit assumptions in GTMWindowSheetController explicit by
adding asserts.
Original review at http://codereview.appspot.com/4418041/
R=avi
APPROVED=avi
DELTA=8 (6 added, 0 deleted, 2 changed)
Diffstat (limited to 'AppKit')
-rw-r--r-- | AppKit/GTMWindowSheetController.h | 7 | ||||
-rw-r--r-- | AppKit/GTMWindowSheetController.m | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/AppKit/GTMWindowSheetController.h b/AppKit/GTMWindowSheetController.h index 558814e..7991112 100644 --- a/AppKit/GTMWindowSheetController.h +++ b/AppKit/GTMWindowSheetController.h @@ -74,8 +74,11 @@ delegate:(id <GTMWindowSheetControllerDelegate>)delegate; // Starts a view modal session for a sheet. Intentionally similar to -// -[NSApplication beginSheet:modalForWindow:modalDelegate:didEndSelector: -// contextInfo:]. +// -[NSApplication +// beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]. +// You must only call this method if the currently active view is |view| or +// |nil|; this means you can call this method only after creating the +// GTMWindowSheetController or after calling -setActiveView:view. // // Args: // sheet: The window object representing the sheet you want to diff --git a/AppKit/GTMWindowSheetController.m b/AppKit/GTMWindowSheetController.m index bf85e59..92e2526 100644 --- a/AppKit/GTMWindowSheetController.m +++ b/AppKit/GTMWindowSheetController.m @@ -339,6 +339,9 @@ willPositionSheet:(NSWindow*)sheet } [invocation invokeWithTarget:systemSheet]; + _GTMDevAssert(!activeView_ || activeView_ == view, + @"You have to call setActiveView:view before " + "calling beginSheet:modalForView:view"); activeView_ = view; } |