Re: Fixing logged error that doesn't throw exception
Re: Fixing logged error that doesn't throw exception
- Subject: Re: Fixing logged error that doesn't throw exception
- From: Graham Cox <email@hidden>
- Date: Thu, 28 May 2009 12:04:11 +1000
On 28/05/2009, at 11:40 AM, Ken Thomases wrote:
On May 27, 2009, at 7:15 PM, Graham Cox wrote:
I'm getting this in the log when I open the "Customize Toolbar"
sheet:
-[NSConcreteAttributedString initWithString:] called with nil
string argument. This has undefined behavior and will raise an
exception in post-Leopard linked apps. This warning is displayed
only once.
Is this a bug in the frameworks or in my code?
Probably your code. Presumably Apple has tried to eliminate all
instances of this bug in their own code.
Agreed - though see below.
I tried setting a symbolic breakpoint on this but it doesn't fire
at all, though if it did I'm not sure how I'd make it conditional
on the string being nil as there are no debugging symbols.
You could test the location on the stack which holds the parameter.
On x86, that's:
*(id*)($ebp + 16)
Ah, thanks! It's been a while and I'd forgotten how to use that
approach. OK, I got it to break. Here's the stack trace. Appears to be
entirely framework code. My toolbar is entirely constructed within IB
using standard items with nothing apparently tricky going on - just
toolbar buttons hooked to actions. The error is logged when the
"Customise Toolbar" dialog is invoked. If it still could be my code,
any pointers as to where I should look? It appears to be attempting to
copy a text field by archiving it. The only field I have in the
toolbar is a search field - looks entirely standard as far as I can see.
#0 0x93d221e6 in -[NSConcreteAttributedString initWithString:]
#1 0x93d220eb in -[NSConcreteAttributedString
initWithString:attributes:]
#2 0x93d3c673 in -[NSNumberFormatter(NSNumberFormatterCompatibility)
attributedStringForZero]
#3 0x93e4e97d in -[NSNumberFormatter encodeWithCoder:]
#4 0x93d2d39d in _encodeObject
#5 0x94e855bd in -[NSCell encodeWithCoder:]
#6 0x94e84fb3 in -[NSActionCell encodeWithCoder:]
#7 0x94e84deb in -[NSTextFieldCell encodeWithCoder:]
#8 0x93d2d39d in _encodeObject
#9 0x94e84da9 in -[NSControl encodeWithCoder:]
#10 0x94e84b76 in -[NSTextField encodeWithCoder:]
#11 0x93d2d39d in _encodeObject
#12 0x93d9dbed in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:]
#13 0x93d4d5b7 in -[NSArray(NSArray) encodeWithCoder:]
#14 0x93d2d39d in _encodeObject
#15 0x94e83ec8 in -[NSView encodeWithCoder:]
#16 0x93d2d39d in _encodeObject
#17 0x93d9dbed in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:]
#18 0x93d4d5b7 in -[NSArray(NSArray) encodeWithCoder:]
#19 0x93d2d39d in _encodeObject
#20 0x94e83ec8 in -[NSView encodeWithCoder:]
#21 0x9503fae5 in -[NSBox encodeWithCoder:]
#22 0x93d2d39d in _encodeObject
#23 0x93d2cb18 in +[NSKeyedArchiver archivedDataWithRootObject:]
#24 0x9527a38d in -[NSToolbarItem _copyOfCustomView]
#25 0x9527a44c in -[NSToolbarItem copyWithZone:]
#26 0x9718c05a in -[NSObject copy]
#27 0x94e16da2 in -[NSToolbar
_newItemFromItemIdentifier:requireImmediateLoad:willBeInsertedIntoToolbar
:]
#28 0x952748e2 in -[NSToolbar
toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:]
#29 0x94e19d80 in -[NSToolbar
_newItemFromDelegateWithItemIdentifier:willBeInsertedIntoToolbar:]
#30 0x94e16dfe in -[NSToolbar
_newItemFromItemIdentifier:requireImmediateLoad:willBeInsertedIntoToolbar
:]
#31 0x94e16bed in -[NSToolbar
_insertNewItemWithItemIdentifier:atIndex:notifyDelegate:notifyView:notifyFamilyAndUpdateDefaults
:]
#32 0x94e6fea4 in -[NSToolbar
_appendNewItemWithItemIdentifier:notifyDelegate:notifyView:notifyFamilyAndUpdateDefaults
:]
#33 0x94e187cb in -[NSToolbar
_setCurrentItemsToItemIdentifiers:notifyDelegate:notifyView:notifyFamilyAndUpdateDefaults
:]
#34 0x95272abf in -[NSToolbar
_loadInitialItemIdentifiers:requireImmediateLoad:]
#35 0x95277f2a in -[NSToolbarConfigPanel _loadData]
#36 0x95277921 in -[NSToolbarConfigPanel initForToolbar:withWidth:]
#37 0x95273019 in -[NSToolbar _runCustomizationPanel]
#38 0x94e9c524 in -[NSToolbarButton sendAction:to:]
#39 0x94e9c4b5 in -[NSToolbarButton sendAction]
#40 0x94e9ba36 in -[NSToolbarItemViewer mouseDown:]
#41 0x94d56133 in -[NSWindow sendEvent:]
#42 0x94d22cd9 in -[NSApplication sendEvent:]
#43 0x94c8062f in -[NSApplication run]
#44 0x94c4d834 in NSApplicationMain
_______________________________________________
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