Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
- Subject: Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
- From: Ken Thomases <email@hidden>
- Date: Wed, 14 Oct 2015 08:49:14 -0500
On Oct 14, 2015, at 5:44 AM, Lakshmi P Shanmugam <email@hidden> wrote:
> Thanks for your response.
You're welcome.
> Hover over a cell in a Table. Framework calls NSCell expansionFrameWithFrame:inView. And then calls NSCell cellSize. In our overridden implementation of cellSize, we try to get the graphics context using currentContext. This worked fine in all previous versions upto OSX 10.11 and started failing now.
> Any idea on what could be wrong?
Yes, you're expecting a context to be current when there's no reason to expect that. You were just getting unlucky before. Yes, "unlucky", precisely because you were lulled into thinking what you were doing was OK and started depending on it, when it was never guaranteed and was subject to change, as you've now discovered. Lucky would have been to have discovered the problem back when you first chose this implementation approach.
You need to change your implementation of -cellSize to not rely on there being any particular graphics context set up. What were you using it for?
Regards,
Ken
_______________________________________________
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