Program crashed after edit values at NSTableView
Program crashed after edit values at NSTableView
- Subject: Program crashed after edit values at NSTableView
- From: Peter C <email@hidden>
- Date: Sat, 8 May 2010 12:21:05 +0800
Hello all,
I am doing a program to input align image values for horizontal and vertical. Basically it uses NSTableview to enter integer at horizontal and vertical columns. It work fine until the close button is clicked, the window is suppose to end modal mode and close window. But somehow it crashed, from crashed log, it seems the window is still trying to update NSTableView even though the window is already closed. How do I prevent windows or NSTableView updating after window is close ?
Peter C
Here is the snippet of the codes,
- (IBAction)editButtonAction:(id)sender
{
AlignWindowController *alignWindowController;
alignWindowController = [[AlignWindowController alloc] initWithWindowNibName:@"AlignWin"];
[alignWindowController window];
[alignWindowController setArray:testArray];
if ([NSApp runModalForWindow:[alignWindowController window]] == NSOKButton) {
}
[alignWindowController autorelease];
}
// =================================== part of AlignWindowController
- (IBAction)closeButtonAction:(id)sender
{
[NSApp stopModalWithCode:NSOKButton];
[[self window] close];
}
- (NSInteger) numberOfRowsInTableView: (NSTableView *) theTableView
{
return [colorObjArray count];
}
- (id) tableView:(NSTableView *) theTableView
objectValueForTableColumn:(NSTableColumn *)theColumn row:(NSInteger)rowIndex
{
NSString *colStr;
PrintAlignObj *alignObj;
alignObj = [colorObjArray objectAtIndex:rowIndex];
colStr = [theColumn identifier];
if ([colStr isEqualToString:@"horizontal"]) {
return alignObj.horzNumber;
} else if ([colStr isEqualToString:@"vertical"]) {
return alignObj.vertNumber;
}
return nil;
}
- (void) tableView:(NSTableView *)theTableView setObjectValue:(id)obj
forTableColumn:(NSTableColumn *)theColumn row:(NSInteger)rowIndex
{
PrintAlignObj *alignObj;
NSString *editStr;
NSString *idenStr;
int val;
editStr = [obj description];
idenStr = [theColumn identifier];
alignObj = [colorObjArray objectAtIndex:rowIndex];
if ([idenStr isEqualToString:@"horizontal"]) {
val = [editStr intValue];
if (val >= PIXEL_MIN && val <= PIXEL_MAX)
alignObj.horzNumber = [NSNumber numberWithInt:val];
} else if ([idenStr isEqualToString:@"vertical"]) {
val = [editStr intValue];
if (val >= PIXEL_MIN && val <= PIXEL_MAX)
alignObj.vertNumber = [NSNumber numberWithInt:val];
}
}
// ===========================================
Date/Time: 2010-05-08 11:56:55.313 +0800
OS Version: Mac OS X 10.6.3 (10D578)
Report Version: 6
Interval Since Last Report: 180589 sec
Crashes Since Last Report: 16
Per-App Interval Since Last Report: 17010 sec
Per-App Crashes Since Last Report: 6
Anonymous UUID: E296B5C0-F953-46AB-99F1-1AB33B68EA97
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000099
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x98877ed7 objc_msgSend + 23
1 com.apple.AppKit 0x97fc3cb2 -[NSTableView preparedCellAtColumn:row:] + 335
2 com.apple.AppKit 0x97fde18c -[NSTableView _drawContentsAtRow:column:withCellFrame:] + 56
3 com.apple.AppKit 0x97fdd1fa -[NSTableView drawRow:clipRect:] + 1131
4 com.apple.AppKit 0x97fdcc32 -[NSTableView drawRowIndexes:clipRect:] + 360
5 com.apple.AppKit 0x97fdb60b -[NSTableView drawRect:] + 1144
6 com.apple.AppKit 0x97fd11cc -[NSView _drawRect:clip:] + 3721
7 com.apple.AppKit 0x97fce898 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 2217
8 com.apple.AppKit 0x97fcf22b -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
9 com.apple.AppKit 0x97fcf22b -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
10 com.apple.AppKit 0x97fcf22b -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
11 com.apple.AppKit 0x97fcf22b -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
12 com.apple.AppKit 0x97fcde2b -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 265
13 com.apple.AppKit 0x97fca771 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3309
14 com.apple.AppKit 0x97f2b3ee -[NSView displayIfNeeded] + 818
15 com.apple.AppKit 0x97ef46ec -[NSWindow displayIfNeeded] + 204
16 com.apple.AppKit 0x97f25c26 _handleWindowNeedsDisplay + 696
17 com.apple.CoreFoundation 0x9407e2e2 __CFRunLoopDoObservers + 1186
18 com.apple.CoreFoundation 0x9403aa1d __CFRunLoopRun + 557
19 com.apple.CoreFoundation 0x9403a0f4 CFRunLoopRunSpecific + 452
20 com.apple.CoreFoundation 0x94039f21 CFRunLoopRunInMode + 97
21 com.apple.HIToolbox 0x927f00fc RunCurrentEventLoopInMode + 392
22 com.apple.HIToolbox 0x927efded ReceiveNextEventCommon + 158
23 com.apple.HIToolbox 0x927efd36 BlockUntilNextEventMatchingListInMode + 81
24 com.apple.AppKit 0x97efc135 _DPSNextEvent + 847
25 com.apple.AppKit 0x97efb976 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
26 com.apple.AppKit 0x97ebdbef -[NSApplication run] + 821
27 com.apple.AppKit 0x97eb5c85 NSApplicationMain + 574
28 com.my.test 0x0000277a main + 24 (main.m:14)
29 com.my.test 0x00002736 start + 54
Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x93c2bb42 kevent + 10
1 libSystem.B.dylib 0x93c2c25c _dispatch_mgr_invoke + 215
2 libSystem.B.dylib 0x93c2b719 _dispatch_queue_invoke + 163
3 libSystem.B.dylib 0x93c2b4be _dispatch_worker_thread2 + 240
4 libSystem.B.dylib 0x93c2af41 _pthread_wqthread + 390
5 libSystem.B.dylib 0x93c2ad86 start_wqthread + 30
Thread 2:
0 libSystem.B.dylib 0x93c33262 __semwait_signal + 10
1 libSystem.B.dylib 0x93c5ee44 nanosleep$UNIX2003 + 188
2 libSystem.B.dylib 0x93c5ed82 usleep$UNIX2003 + 61
3 com.apple.AppKit 0x98065885 -[NSUIHeartBeat _heartBeatThread:] + 2039
4 com.apple.Foundation 0x90b708dc -[NSThread main] + 45
5 com.apple.Foundation 0x90b7088c __NSThread__main__ + 1499
6 libSystem.B.dylib 0x93c32a19 _pthread_start + 345
7 libSystem.B.dylib 0x93c3289e thread_start + 34
Thread 3:
0 libSystem.B.dylib 0x93c2abd2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x93c2b168 _pthread_wqthread + 941
2 libSystem.B.dylib 0x93c2ad86 start_wqthread + 30
Thread 4: Dispatch queue: com.apple.root.default-priority
0 libSystem.B.dylib 0x93c05342 semaphore_wait_signal_trap + 10
1 libSystem.B.dylib 0x93c0ae06 pthread_mutex_lock + 490
2 com.apple.Foundation 0x90b66463 -[NSLock lock] + 201
3 com.apple.AppKit 0x980669d4 __-[NSUIHeartBeat updateHeartBeatState]_block_invoke_2 + 49
4 com.apple.Foundation 0x90ba04d7 -[NSBlockOperation main] + 231
5 com.apple.Foundation 0x90b9833f -[__NSOperationInternal start] + 811
6 com.apple.Foundation 0x90b97f65 ____startOperations_block_invoke_2 + 94
7 libSystem.B.dylib 0x93c391e4 _dispatch_call_block_and_release + 16
8 libSystem.B.dylib 0x93c2b4b2 _dispatch_worker_thread2 + 228
9 libSystem.B.dylib 0x93c2af41 _pthread_wqthread + 390
10 libSystem.B.dylib 0x93c2ad86 start_wqthread + 30
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00242750 ebx: 0x98046cc0 ecx: 0x98698258 edx: 0x00000079
edi: 0x0025fdb0 esi: 0x0025fdb0 ebp: 0xbfffd0c8 esp: 0xbfffd088
ss: 0x0000001f efl: 0x00010206 eip: 0x98877ed7 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x00000099
_______________________________________________
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