_CGXRemoveWindowFromWindowMovementGroup: window (0x...) is not attached to window (0x..)

So I seem to be getting this really weird issue when dismissing a sheet sometimes. I call


[self.window endSheet:sheetWindow];


It doesn't happen all the time, but when it happens, the sheet "disappears" without animation and I see this logs out in Console:


_CGXRemoveWindowFromWindowMovementGroup: window is not attached to window


I'm 100% certain that the window is a sheet on window at the time I call endSheet:


Also weird because clicking in self.window after dismissing the sheet does not work (that is, clicking on clickable views like buttons and such does nothing) until I bring another app to the foreground, and then click to bring my app frontmost again.


Anyone run into this and perhaps know what could be causing it?


Thanks

Replies

If I log out:


NSWindow *sheetParent = theSheetWindow.sheetParent;
    NSLog(@"Sheet parent: %@",sheetParent);


Just before the call to endSheet: ...I can see that the property is set to self.window...still no idea what's causing this to happen.

seems to occur *after* opening another separate window (and then closing it) *just before*...running the sheet. Still haven't been able to find a workaround.

Well....I think I found a workaround. Looks like this is a really weird bug. If just before calling end sheet if I send NSApp an activateIgnoringOtherApps: message the sheet seems to always dismiss as expected.


As mentioend earlier, this only happens if I open another window first, close it, then show the sheet back in the "main window". Why, I do not know...


My app is already active, as it just got a key down event to dismiss the sheet (the return key). Not sure why the system loses track of the sheet without the activateIgnoreOtherApps call...