• 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: NSArrayController selection bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController selection bug?


  • Subject: Re: NSArrayController selection bug?
  • From: Jesse Grosjean <email@hidden>
  • Date: Mon, 10 Nov 2003 17:49:59 -0500

mmalc,

> As far as I'm aware (**although this is the subject of some debate,
> for which I'm awaiting resolution**) this isn't a bug.
>
> The array itself is not observed, so you're changing the array behind
> the controller's back. Granted you're calling setContentArray, but
> you're passing in the same object, so I'd guess that there's some
> optimisation to ensure no notification is sent. The appropriate thing
> to do is either to send a message to the controller (which seems like
> a fairly logical thing to do since it's managing the display...?) or
> implement the mutable array accessors and call
> removeObjectFromContentArrayAtIndex:

I think what I'm seeing is a different case. I'm pretty sure that the
NSArrayController does get notified of my change, but the problem is
that it's using invalid cached state (the selected indexes) to update
itself.

I've added an extra action to your test application ("remove UMA") that
will show the problem. Add a few objects, and then, making sure that
the last object in the tableview is selected, click the new "remove
UMA" button. You should see an index of of bounds exception.

> I've put an example of the different cases at:
> http://homepage.mac.com/mmalc/CocoaExamples/AddBehindTheScenes.zip

Thanks, I've attached a version with my additions.

[demime 0.98b removed an attachment of type application/zip which had a name of AddBehindTheScenes.zip]
Jesse
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSArrayController selection bug?
      • From: mmalcolm crawford <email@hidden>
    • Re: NSArrayController selection bug?
      • From: Henrik Wittland <email@hidden>
References: 
 >NSArrayController selection bug? (From: Jesse Grosjean <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: itunes for windows HOWTO ???
  • Next by Date: Re: NSArrayController selection bug?
  • Previous by thread: Re: NSArrayController selection bug?
  • Next by thread: Re: NSArrayController selection bug?
  • Index(es):
    • Date
    • Thread