From e27ef9a94628853e1ab7dd9cf7ac883d96596dda Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Thu, 14 Apr 2011 19:30:15 +0000 Subject: [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) --- AppKit/GTMWindowSheetController.h | 7 +++++-- AppKit/GTMWindowSheetController.m | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'AppKit') 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 )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; } -- cgit v1.2.3