Re: NSTableView crashing on scroll+update
Re: NSTableView crashing on scroll+update
- Subject: Re: NSTableView crashing on scroll+update
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 31 Jul 2007 09:02:47 -0700
On 7/31/07, Marcelo Alves <email@hidden> wrote:
> Hi,
>
> I'm working with NSTableView and Cocoa Bindings. Things are
> working fine, but, NSTableView crashes (log below) when I update my
> NSMutableSet while scrolling the NSTableView (with ~300 items). If
> I'm not scrolling, work as expected. My first (and only one) guess
> was locking the set, like :
>
> -(void) replaceRoomsWith:(NSArray *)newRooms {
> NSSet *new_set = [NSSet setWithArray:newRooms];
> [self willChangeValueForKey:@"rooms"
> withSetMutation:NSKeyValueUnionSetMutation usingObjects:new_set];
>
> @synchronized(rooms){
> [rooms unionSet:new_set];
> }
>
> [self didChangeValueForKey:@"rooms"
> withSetMutation:NSKeyValueUnionSetMutation usingObjects:new_set];
> }
>
> But it didn't work. What should I do to avoid this annoying problem?
>
> Some extra information :
>
> - The application is multithreaded (ok, only extra thread), based
> on Communicating With Distributed Objects [1], but I'm doing all the
> changes in the set in the main thread;
Are you sure you are only updating on the main thread?
Why the use of @synchronized in the above if updates only take place
on the main thread?
-Shawn
_______________________________________________
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