• 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: DataSource modified while TableView is displaying data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DataSource modified while TableView is displaying data


  • Subject: Re: DataSource modified while TableView is displaying data
  • From: Roland King <email@hidden>
  • Date: Thu, 26 Apr 2012 20:01:25 +0800

how about using @synchronize to avoid it

On Apr 26, 2012, at 6:23 PM, Jean Suisse wrote:

> Dear Peter,
>
> Thank you for your reply. Here is the requested code (see below).
> After more investigations, I would like to take back a previous statement, that the tableview was perfectly aware that the number of rows in the DS was changed. This is due to my inexperience in stepping through the code across multiple threads.
>
> Here are the facts :
>
> - Only the controller removes rows from the datasource. Either in response to user actions (canceling tasks) or as a result of a Task completed notification from a running task.
> - Each change in the dataSource is immediately followed by a reloadData message sent to the TableView.
> - Sometimes, randomly, the TableView requests a row index that is out of bounds by one index (e.g. row #5 when the dataSource contains only 5 elements).
>
> I am thinking that a redraw occurs in-between the removal of one element of the table and the reloadData message.
> For now, I did a quick fix for this issue by adding a category with "safeObjectAtIndex"…. But one way to be certain would be to ensure that the two messages (removal + reloadData) are sent without any thread/process switching occurring…
>
> The code for numberOfRowsInTableView : (experimentList is an instance of NSMutableAray)
>
> - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView
> {
> 	return self.experimentList ? [self.experimentList count] : 0;
> }
>
> Jean
>
>
> On 26 avr. 2012, at 11:45, Peter Hudson wrote:
>
>>
>> Can you post your code for     numberOfRowsInTableView:
>>
>> Peter
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: DataSource modified while TableView is displaying data (From: Peter Hudson <email@hidden>)
 >Re: DataSource modified while TableView is displaying data (From: Jean Suisse <email@hidden>)

  • Prev by Date: Re: DataSource modified while TableView is displaying data
  • Next by Date: RE: removeFromSuperview problem
  • Previous by thread: Re: DataSource modified while TableView is displaying data
  • Next by thread: Re: DataSource modified while TableView is displaying data
  • Index(es):
    • Date
    • Thread