Standard Cocoa Save Panel crashing in Leopard
Standard Cocoa Save Panel crashing in Leopard
- Subject: Standard Cocoa Save Panel crashing in Leopard
- From: John Nairn <email@hidden>
- Date: Fri, 21 Dec 2007 14:21:04 -0800
I posted messages recently about frequent crashes in standard open and
save panels (in Leopard only) and was assured it must be bug in my
code. The crash log looked like it crashed on a message involving
NSTextStorage and indeed I found an NSTextStorage object I was using
to format labels for a graphic view. I was releasing that object's
layout manager, but not the object. That sounded like the problem. I
fixed it and the crashing stopped for a couple of days. Today it
crashed again during a simple save as panel and the crash log (see
below) still mentions NSTextStorage. I looked again, but can not find
any more NSTextStorage objects in my code.
I have run with NSZombies enabled, but the crashes are rare and thus
hard to catch. Prior to the fix of my NSTextStorage object bug I got
2007-12-04 16:56:44.131 NairnFEAMPM[27778:10b] *** -[NSLayoutManager
textStorage:edited:range:changeInLength:invalidatedRange:]: message
sent to deallocated instance 0x167c9420
which also looked like my NSTextStorage object.
Here is my "fixed" code to create an NSTextObject:
textStorage = [[NSTextStorage alloc] initWithString:@"Hello"];
layoutManager = [[NSLayoutManager alloc] init];
textContainer = [[NSTextContainer alloc] init];
[layoutManager addTextContainer:textContainer];
[textContainer release]; // The layoutManager will retain
[textStorage addLayoutManager:layoutManager];
[layoutManager setUsesScreenFonts:NO];
[layoutManager release]; // The textStorage will retain
Then when the object is deallocated, I call [textStorage release].
Here is piece of recent crash log which still looks like an
NSTextStorage problem:
Process: NairnFEAMPM [37688]
Path: /Users/jnairn/Programming/Cocoa_Projects/NairnFEAMPM/
build/Default/NairnFEAMPM.app/Contents/MacOS/NairnFEAMPM
Identifier: com.geditcom.NairnFEAMPM
Version: Version 1.6 (build 1)
Code Type: X86 (Native)
Parent Process: launchd [37563]
Date/Time: 2007-12-21 11:17:26.308 -0800
OS Version: Mac OS X 10.5.1 (9B18)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000d027ef9b
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x9650c695 _class_isInitialized + 14
1 libobjc.A.dylib 0x9650248a
_class_lookupMethodAndLoadCache + 66
2 libobjc.A.dylib 0x96512736 objc_msgSend + 102
3 com.apple.AppKit 0x91de4834 -[NSTextStorage
fontSetChanged] + 363
4 com.apple.CoreFoundation 0x96b97da5 -[NSArray
makeObjectsPerformSelector:] + 565
5 com.apple.AppKit 0x91de4661 +[NSTextStorage
_fontSetChanged:] + 228
6 com.apple.Foundation 0x918ad67a _nsnote_callback + 106
7 com.apple.CoreFoundation 0x96b0aa4a __CFXNotificationPost +
362
8 com.apple.CoreFoundation 0x96b0ad23
_CFXNotificationPostNotification + 179
9 com.apple.Foundation 0x918aaa70 -[NSNotificationCenter
postNotificationName:object:userInfo:] + 128
10 com.apple.Foundation 0x918b4108 -[NSNotificationCenter
postNotificationName:object:] + 56
11 com.apple.AppKit 0x92009e29 +[NSFont
_postFontSetChangedNotifications] + 75
12 com.apple.Foundation 0x918aebfc __NSThreadPerformPerform
+ 476
13 com.apple.CoreFoundation 0x96b29698 CFRunLoopRunSpecific +
3240
14 com.apple.CoreFoundation 0x96b29d38 CFRunLoopRunInMode + 88
15 com.apple.HIToolbox 0x9003b8a4
RunCurrentEventLoopInMode + 283
16 com.apple.HIToolbox 0x9003b5f6 ReceiveNextEventCommon +
175
17 com.apple.HIToolbox 0x9003b531
BlockUntilNextEventMatchingListInMode + 106
18 com.apple.AppKit 0x91bacd5b _DPSNextEvent + 657
19 com.apple.AppKit 0x91bac6a0 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
20 com.apple.AppKit 0x91d5d29c -[NSApplication
_shouldTerminate] + 529
21 com.apple.AppKit 0x91d5ce6e -[NSApplication
terminate:] + 274
22 com.apple.AppKit 0x91c7df94 -[NSApplication
sendAction:to:from:] + 112
23 com.apple.AppKit 0x91d2c868 -[NSMenu
performActionForItemAtIndex:] + 493
24 com.apple.AppKit 0x91d2c56d -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] + 220
25 com.apple.AppKit 0x91d2c1f2 -[NSMenu
performKeyEquivalent:] + 866
26 com.apple.AppKit 0x91d2aa99 -[NSApplication
_handleKeyEquivalent:] + 492
27 com.apple.AppKit 0x91c47e4e -[NSApplication
sendEvent:] + 3824
28 com.apple.AppKit 0x91ba5705 -[NSApplication run] + 847
29 com.apple.AppKit 0x91b729ba NSApplicationMain + 574
30 com.geditcom.NairnFEAMPM 0x00002b3c _start + 210
31 com.geditcom.NairnFEAMPM 0x00002a69 start + 41
---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj
_______________________________________________
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