views:

40

answers:

0

a button's IBAction in windowA calls runModalForWindow:windowB.

windowB becomes key and modal.

windowB has a popUpWindowDatePicker which calls stopModal upon display, and then popUpWindowDatePicker becomes key, and windowB resigns key and is not modal. no window is modal at this point.

when popUpWindowDatePicker is dismissed, its didResignFirstResponder method sets a boolean to YES. windowB then becomes key, and windowB's windowController windowDidBecomeKeyNotification fires, checks the boolean value and if it is YES calls runModalForWindow:self.window.

now windowB is modal and key. windowA is still open, but not key.

windowB has Okay and Cancel buttons which call: [NSApp stopModalWithCode:returnCode] and then orderOut: and close on windowB.

if the popUpWindowDatePicker is used, and then any time after that windowB is closed with Okay or Cancel, an Assertion Failure is called involving the Okay or Cancel buttons:

*** Assertion failure in -[NSButton lockFocus], /SourceCache/AppKit/AppKit-1038.29/AppKit.subproj/NSView.m:5237

-[NSButton(0x20021cd60) lockFocus] failed with window=0x20021c0c0, windowNumber=-1, [self isHiddenOrHasHiddenAncestor]=0

if windowB is closed with Okay or Cancel and popUpWindowDatePicker has not been used, there is no assertion failure.

it seems that the sequence runModal-stopModal-runModal-stopModal on windowB is involved in the failure of lockFocus on the button pressed, but i can't find a way to trace down more than this to solve this problem.

can anyone offer any hints or thoughts?