Re: Crashes in Framework? Tracking down ghosts.
Re: Crashes in Framework? Tracking down ghosts.
- Subject: Re: Crashes in Framework? Tracking down ghosts.
- From: Quincey Morris <email@hidden>
- Date: Mon, 13 Jul 2009 11:24:34 -0700
On Jul 13, 2009, at 09:56, K.Darcy Otto wrote:
I'm working on an application which is nearing completion, but I'm
getting these strange crashes that look to be deep in the cocoa
framework. The thing is, I can't seem to diagnose these crashes,
and I can't imagine that such bugs exist in the framework such that
they pull down my application so frequently. So, I'm assuming it is
something I'm doing. I am using garbage collection, and I'm getting
an EXC_BAD_ACCESS error. And at least one crash that pops up every
so often is below. It stops on the following line of code of the
init method (#6 below) in my PrintView class:
NSFont *font = [NSFont fontWithName:@"Lucida Grande" size:fontSize];
#0 0x931ad644 in CFDictionaryGetValue
#1 0x901f4fb8 in TDescriptor::CreateMatchingDescriptorInternal
#2 0x901f4e1c in TDescriptor::InitBaseFont
#3 0x901f4d94 in TDescriptor::CreateMatchingDescriptor
#4 0x921d48ec in __NSFontFactoryWithName
#5 0x921d466c in +[NSFont fontWithName:size:]
#6 0x0005e2e0 in -[PrintView
initWithScopeDeduction:andHelper:andDeductionController:] at
PrintView.m:32
#7 0x00006a8c in -[MyDocument printOperationWithSettings:error:] at
MyDocument.m:441
#8 0x9241bde8 in -[NSDocument
_printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo
:]
#9 0x9241bce0 in -[NSDocument
printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo
:]
#10 0x921f58b8 in -[NSApplication sendAction:to:from:]
#11 0x922911d0 in -[NSMenu performActionForItemAtIndex:]
#12 0x92290f00 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
#13 0x92290bc8 in -[NSMenu performKeyEquivalent:]
#14 0x9228f6ac in -[NSApplication _handleKeyEquivalent:]
#15 0x921c5d84 in -[NSApplication sendEvent:]
#16 0x92132e44 in -[NSApplication run]
#17 0x92103820 in NSApplicationMain
#18 0x00015bf8 in main at main.m:13
fontSize is valid. If I look into local variables, I get "_name"
being "invalid". But if there is a problem with the name, that
would be strange, since it works most of the time. Any ideas as to
how I can diagnose this problem? I also have seemingly random
crashes of this sort when the "open file" dialogue is opened. Thanks,
What version of Mac OS X are you using?
There are a couple of possibilities here ...
It may be that you have a corrupt font file. Font handling doesn't
seem to be very robust in those circumstances. Do these crashes happen
on certain Macs but not others?
It *appears* (but take this as hearsay, not fact) that some part of
the font mechanism isn't entirely GC compatible, and possibly objects
you pass to font routines get garbage collected too early. Are you
passing the literal string @"Lucida Grande" or are you really passing
something else?
Prior to 10.5.5, GC-apps used to crash frequently in the open/save
panels because of a frameworks problem with the preview pane (in a
column view, where you can play movies, etc). This was "fixed" in
10.5.5, but I still get occasional similar random crashes in 10.5.7,
usually right after the pane is closed. It is known that these panels
don't release their resources correctly under GC, at least in some
apparently harmless cases, but clearly there's still a nasty problem
lurking somewhere. OTOH, it's not impossible that this is related to a
corrupted font file too.
That's not much help, but it's likely this isn't caused by anything
you're doing wrong. (Unless you are doing something wrong.)
_______________________________________________
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