On Oct 30, 2012, at 17:27 , Roland King <r...@rols.org> wrote: > I must be missing something here. Why can't you just set up your > CFSocketContext with CFRetain for the CFAllocatorRetainCallback, CFRelease > for the CFAllocatorReleaseCallback and cast the object to the (void*)info > paramter with (__bridge void*)yourObject when you put that into the > CFSocketContext. Job done, the CFSocket code will call CFRetain() for you > during CFSocketCreateConnectedToSocketSignature(), which will retain it > before ARC releases the original, and will call CFRelease() when the socket > deallocs. > > You don't want CFBridgingRetain() here because you aren't passing ownership > to Core Foundation, you're just giving it the object and it's taking > ownership and releasing it again via the retain and release methods you've > told it to use in CFSocketContext.
One thing that's not clear in the docs for CFSocketCreateConnectedToSocketSignature() is what happens to the CFSocketSignature parameter. Is that information copied immediately, or should it persist? is the supplied CFDataRef retained? The docs are clear about the context parameter, but not this one. -- Rick _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com