NSTableView crashing on scroll+update
NSTableView crashing on scroll+update
- Subject: NSTableView crashing on scroll+update
- From: Marcelo Alves <email@hidden>
- Date: Tue, 31 Jul 2007 12:49:38 -0300
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;
- Tried (without success, and it doesn't like a memory management
problem) removing some release and autorelease method calls;
- Added some extra retain calls, preventing some deallocations.
- The log is below :
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000
Thread 0 Crashed:
0 com.apple.Foundation 0x928964b4 NSHashRemove + 73
1 com.apple.AppKit 0x937b415f -[_NSModelObservingTracker
stopObservingModelObjectAtReferenceIndex:] + 169
2 com.apple.AppKit 0x93529f04 -[_NSModelObservingTracker
setObservingToModelObjectsRange:] + 260
3 com.apple.AppKit 0x93529dbc -[_NSBindingAdaptor
tableView:updateVisibleRowInformation:] + 140
4 com.apple.AppKit 0x933d4e61 -[NSTableView drawRect:] + 384
5 com.apple.AppKit 0x933013b1 -[NSView _drawRect:clip:] +
3228
6 com.apple.AppKit 0x932ff893 -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] + 1273
7 com.apple.AppKit 0x93300041 -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] + 3239
8 com.apple.AppKit 0x932fe362 -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
+ 523
9 com.apple.AppKit 0x932fdc8e -[NSView displayIfNeeded] + 439
10 com.apple.AppKit 0x932f438b -[NSClipView
_immediateScrollToPoint:] + 2761
11 com.apple.AppKit 0x9342bd6a -[NSScrollView
scrollClipView:toPoint:] + 417
12 com.apple.AppKit 0x932bf32f -[NSClipView
_scrollTo:animate:] + 1294
13 com.apple.AppKit 0x9342ba92 -[NSScrollView
_doScroller:hitPart:multiplier:] + 961
14 com.apple.AppKit 0x9342b691 -[NSScrollView _doScroller:]
+ 71
15 com.apple.AppKit 0x9336fd88 -[NSApplication
sendAction:to:from:] + 107
16 com.apple.AppKit 0x9336fce1 -[NSControl sendAction:to:]
+ 101
17 com.apple.AppKit 0x9342b637 -[NSScroller sendAction:to:]
+ 88
18 com.apple.AppKit 0x936b4427 -[NSScroller
_scrollByDelta:] + 272
19 com.apple.AppKit 0x936b653d -[NSScrollView scrollWheel:]
+ 904
20 com.apple.AppKit 0x932f5b59 forwardMethod + 82
21 com.apple.AppKit 0x9373a63c -[NSView scrollWheel:] + 267
22 com.apple.AppKit 0x932f5b59 forwardMethod + 82
23 com.apple.AppKit 0x9373a63c -[NSView scrollWheel:] + 267
24 com.apple.AppKit 0x9335fbe1 -[NSWindow sendEvent:] + 7377
25 com.apple.AppKit 0x93351350 -[NSApplication sendEvent:]
+ 5023
26 com.apple.AppKit 0x9327bdfe -[NSApplication run] + 547
27 com.apple.AppKit 0x9326fd2f NSApplicationMain + 573
28 net.solarseek.SolarSeek 0x00008ffc main + 30 (main.m:14)
29 net.solarseek.SolarSeek 0x00001a0e start + 258
30 net.solarseek.SolarSeek 0x00001935 start + 41
[1]: http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/articles/CocoaDOComm.html
:: marcelo.alves
_______________________________________________
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