Async network oriented class & memory management
Async network oriented class & memory management
- Subject: Async network oriented class & memory management
- From: David Aames <email@hidden>
- Date: Wed, 27 Sep 2006 01:24:59 +0100
Hello all,
I've basically implemented some async network utility classes which
report the progress of the transfer to the delegate. Now the question
arises when to free the objects. I've thought a bit about it and
here's what I figured out I could do:
When the network object is doing something like
if([del respondsToSelector:...])
[del ...];
in it's transferDidFinish method and if the delegate releases it in
that method that would most likely produce a crash (since all the
methods after the [del ...]; will be referring to a freed pointer) so
I thought to send that message to the delegate like this
[[NSRunLoop currentRunLoop] performSelector:... target:del
argument:arg order:0 modes:[NSArray
arrayWithObject:NSDefaultRunLoopMode]]
which would not block and all statements after [del ...]; would be
executed properly. Am I on the right track?
Kind regards,
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden