• 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
Re: NSOutlineView: expanding an item retains it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView: expanding an item retains it?


  • Subject: Re: NSOutlineView: expanding an item retains it?
  • From: j o a r <email@hidden>
  • Date: Mon, 24 Jan 2005 13:44:03 +0100


On 2005-01-24, at 12.51, Charlton Wilbur wrote:

Imagine a multithreaded situation. Thread 1 handles the model, perhaps interacting with other computers. Thread 2 responds to user actions. It's entirely possible for Thread 1 to release an object, then for Thread 2 to do something with the outline View -- perhaps expanding the object that was just released -- then for Thread 1 to send the reloadData message.

What does it gain you if the outline view retains the items provided to it? You don't crash in that situation, or in similar ones where reloadData might not be called immediately.

You have to be kidding? Is that how you usually ensure thread "safety"? :-D


What does it cost you? Provided that both the outline view and your code are retain/release balanced, very little. I would expect that the NSOutlineView would release all items provided to it upon receipt of a reloadData message, for that matter; the point is to ensure that the objects do not vanish out from underneath it, to allow for graceful event handling in the event of a programmer not calling reloadData in a timely manner after releasing an object.

If you crash because the controller doesn't call reloadData when it should, then that's a bug in the controller, and not something for the data source or outline view to be concerned with.


More importantly, it doesn't really matter if NSOutlineView retains the objects handed to it or not, so long as it behaves as it is documented. In the case of collection classes, by contrast, it's important to know that collections retain objects stored in them, and knowing that makes memory management easier. In the case of an NSOutlineView, it doesn't really matter, so long as Apple's code is retain/release balanced.

Agreed - that has been my point all along.

j o a r

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: NSOutlineView: expanding an item retains it?
      • From: Charlton Wilbur <email@hidden>
References: 
 >NSOutlineView: expanding an item retains it? (From: Steve Mykytyn <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: j o a r <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: daniel <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: Steven Kramer <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: Charlton Wilbur <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: j o a r <email@hidden>)
 >Re: NSOutlineView: expanding an item retains it? (From: Charlton Wilbur <email@hidden>)

  • Prev by Date: Re: Manual binding questions.
  • Next by Date: Should I override close to free my document's data?
  • Previous by thread: Re: NSOutlineView: expanding an item retains it?
  • Next by thread: Re: NSOutlineView: expanding an item retains it?
  • Index(es):
    • Date
    • Thread