• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Async network oriented class & memory management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Obtain computer model
  • Next by Date: Initialisation and awakeFromNib being called multiple times
  • Previous by thread: Re: no control of NSSlider interval
  • Next by thread: Initialisation and awakeFromNib being called multiple times
  • Index(es):
    • Date
    • Thread