On 12/13/18 11:05 AM, Matt Jacobson wrote:
The buffered nature of the Mac OS X window system means that windows can “display” (i.e., go through the process of updating) even when ordered out.  Ordered-out windows /can/ occasionally be seen on screen (consider App Exposé, which shows minimized windows, or Show All Tabs in apps using NSWindow tabbing), and the system may snapshot or display ordered-out windows for various reasons at other times, too.

In general, I’d say: you should not /rely/ on the fact that ordered-out windows are displayed—in the future, the system might choose to defer it as an optimization—but neither should you expect it not to happen.

Simply bailing out of -drawRect: (which, incidentally, is called on /views/, not windows) seems like a bad idea, since the window may display into an invalid state, which could result in corruption.  I’d instead investigate the underlying cause of the crash, which may result from your view attempting to use an object that it does not hold a strong (or weak-upgraded-to-strong) reference to.

The view was using a C++ object that had been destroyed during closing of my document. I'm afraid that if I start playing with the order of destruction, I'm likely to break something else. But I can be more precise about when I decline to draw, by having my document post a notification when it starts to shut down.

Thanks for the reply.

On Dec 13, 2018, at 10:44 AM, James Walker <jam...@frameforge3d.com <mailto:jam...@frameforge3d.com>> wrote:

I was getting a crash on quit resulting from a drawRect: method being called on a window that had been ordered out.  I can solve the immediate problem just by bailing out of drawRect: if the window is invisible, but I wish I understood what's going on.  The call stack shows a run loop observer calling CA::Transaction::commit() resulting in -[NSWindow displayIfNeeded] being called, but I don't know why displayIfNeeded would do anything with an invisible window.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to