Re: Why would a view be asked to draw after its window has been ordered out?
Re: Why would a view be asked to draw after its window has been ordered out?
- Subject: Re: Why would a view be asked to draw after its window has been ordered out?
- From: Matt Jacobson <email@hidden>
- Date: Thu, 13 Dec 2018 11:05:26 -0800
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.
Matt
> On Dec 13, 2018, at 10:44 AM, James Walker <email@hidden> 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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden