Re: Core Animation warning?
Re: Core Animation warning?
- Subject: Re: Core Animation warning?
- From: Kyle Sluder <email@hidden>
- Date: Wed, 04 Dec 2013 09:14:12 -0800
> On Dec 3, 2013, at 5:23 AM, Graham Cox <email@hidden> wrote:
>
> I’m seeing quite a few of these being logged:
>
>> CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.
>
> I’m not directly using Core Animation anywhere in this app, but I have started to add quite a few threads, e.g. file opening. I’ve set the environment variable as suggested, but it is not doing anything that I can see. This is in 10.9, never seen anything like this in earlier OS either.
>
> Is it something I”m doing, or just another windy warning that I can safely ignore?
We just tracked this down in our own apps to an NSView being deallocated on a background thread. Our file-saving code had managed to hang on to the last remaining reference to our view, and at least on 10.9 -[NSView dealloc] spins up a CATransaction.
Since -[NSView dealloc] has never been thread-safe [1], it presumes that the main thread’s runloop will take care of calling +flush. Obviously this doesn’t happen when executing on the background saving thread.
The solution is to ensure your views are always allocated, deallocated, and otherwise manipulated from the main thread.
[1] “NSView Restrictions”, Threading Programming Guide Appendix A: <https://developer.apple.com/library/mac/documentation/cocoa/conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-123427>
--Kyle Sluder
_______________________________________________
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