Re: Debugging kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region
Re: Debugging kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region
- Subject: Re: Debugging kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region
- From: Jonathan Taylor <email@hidden>
- Date: Thu, 05 Sep 2013 12:52:17 +0100
> Do you have any secondary threads? I assume you do.
Indeed!
> Any code that touches a view, no matter how indirectly, could be the culprit. Bear in mind that sending any message to any view (controls, etc) might invoke -setNeedsDisplay: which in turn could be the trigger for the problem. Try setting a breakpoint on -setNeedsDisplay: though of course it will be hit a lot, so you might need a clever condition to avoid being overwhelmed. Even one that excludes the main thread might help, e.g. [NSThread currentThread] != [NSThread mainThread]
That suggestion for a breakpoint is a great one. Sadly the condition you quoted doesn't seem to be parsed correctly by the debugger, even with casting. Even just "po (NSThread*)[NSThread currentThread]" fails on my machine.
Fortunately, though, there were only a couple of dozen hits on the breakpoint per iteration of the code, and sure enough it immediately pinpointed a case where I was erroneously calling willChangeValueForKey from a secondary thread, which was causing a GUI update as a side-effect.
Cheers
Jonny.
_______________________________________________
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