My macOS 10.12 ARC app has a gazillion bindings.

Many are made in the NIBS but a lot are dynamically applied in code.

In release mode I see the odd crash that can be traced back to NSAutoUnbinder 
getting dealloc'd in a release pool.
With build optimisations set to 0 there is no issue.
With build optimisations set to s there is an issue (a views window has been 
deallocated but the controller dealloc queries the responder chain - which uses 
assign semantics - and boom).

The issue occurs when I inadvertently create a binding when my view controller 
is about to be torn down.
An NSAutoUnbinder gets created during a bind call and added to the thread 
release pool.
The crash occurs when the pool gets drained.

My bindings are such that a dynamic binding can in theory get called when the 
view controller is getting torn down so I would like a general solution that 
mitigates the possible issue.

Two questions:

1. Does anyone have any insight into why the release pool draining seems to be 
an issue in release mode - and I know that trying to second guess the macro 
effect of optimisations is pretty thankless. Does the optimisation affect the 
ARC calls?

2. Wrapping my -bind: calls in a release pool solves the issue too. I can 
easily add a category method that wraps each -bind: call in a release pool. But 
what is the over head for this like?

I can of course crank the release optimisation level down to 0 but I have no 
guarantee that the issue will still not occur in some situations.

Thanks

J

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to