Both the NSLog statements and gdb confirm that [self document] and
[[self document] windowForSheet] return initialized objects.
But does [sheet window] return an initialized object?
Yup, and the sheet does display.
The even weirder thing is that I can replace the [NSApp beginSheet...]
with NSBeginAlertSheet() and the sheet appears normally. The
didEndSelector of that sheet does the [NSApp beginSheet...] call and
this new custom sheet is not attached to the window either.
However, we use [NSApp beginSheet...] other places and it works fine.