-[NSTreeController remove:] sends unnecessary -removeObjectsAtIndexes: messages
| Originator: | kyle.sluder | ||
| Number: | rdar://10611046 | Date Originated: | 12/20/2011 |
| Status: | Open | Resolved: | |
| Product: | Mac OS X | Product Version: | 10.7.2/1138.23 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: If you call -remove: on an NSTreeController, it will send -removeObjectsAtIndexes: to the ancestors of the deleted objects, including to the target of the tree controller's contentArray binding. The NSIndexSet argument will be empty. There is no need to send these messages, and in fact doing so imposes the otherwise unnecessary restriction that the object to which the tree controller's contentArray binding points be a mutable collection (either an NSMutableArray or a mutable to-many property). Steps to Reproduce: 1. Build and run the attached demo project. 2. Select a number of non-root objects. 3. Click the Delete button. Expected Results: The objects are deleted. Actual Results: The objects are deleted, and the AppDelegate logs a bunch of messages complaining that it was asked to -removeObjectsAtIndexes: from the immutable contentArray object.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!