Re: NSToolbar with NSSearchField crash (caused by menu?)
Re: NSToolbar with NSSearchField crash (caused by menu?)
- Subject: Re: NSToolbar with NSSearchField crash (caused by menu?)
- From: Keith Blount <email@hidden>
- Date: Thu, 19 Oct 2006 16:11:14 -0700 (PDT)
Apologies for replying to my own message, but three days later and I have still had no joy tracking this one down. It looks like an over-release bug, but it seems to be happening internally with the menu items. This crash happens when I try to drag my search field from the toolbar customisation palette to the toolbar. It seems that some object is receiving an -encodeWithCoder message that has already been released. If I disconnect the menu from the NSSearchField, then the crash goes away (by my search field needs a menu), so that seems to be the culprit. There is nothing special about the menu except that its items use attributed titles and some of them have checkmarks... I cannot see why having a menu in the search field would cause it to crash. The search field is retained in -awakeFromNib so that is not the issue. I have tried retaining the menu, but that doesn't help because it is only used as a template. I have also tried using [[searchField menu] retain] to retain the _actual_ menu, but this didn't help either.
If anybody knows why a menu in a search field would cause these over-release crashes when dragged from a toolbar customisation palette, I would be very grateful to hear about it. :)
Many thanks in advance,
Keith
On 17 Oct, 2006, at 16:52, Keith Blount wrote:
> Hello,
>
> I have a toolbar that has an NSSearchField in it, using setView: on
> NSToolbarItem. However, I am experiencing a crash when running the
> toolbar customisation palette, when the search field is not visible
> and the user attempts to drag the search field to the toolbar. The
> debugger just shows lots of private and internal methods, but
> things seem to crash on NSMenuItem -encodeWithCoder:. My search
> field has a menu, and it seems that this is what is causing
> problems for the customisation palette. If I disconnect the menu
> from the search field, I don't get any crashes, so this is almost
> certainly the culprit.
>
> So, my question is, how do I fix this? I notice that in Xcode, the
> search field only shows its menu drop down arrow when it is
> actually in the toolbar, and not in the customisation palette, but
> I don't know how I would go about disconnecting the menu only in
> this circumstance. Other programs, such as DevonThink and Camino,
> don't seem to have any problems with having a menu in a search
> field in the toolbar customisation palette...
>
> If anyone could give me any advice on how to fix this bug, I would
> be most grateful.
> Many thanks in advance,
> Keith
---
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000010
Thread 0 Crashed:
0 libobjc.A.dylib 0x90a3e2e8 _class_lookupMethodAndLoadCache + 112
1 libobjc.A.dylib 0x90a3e1d4 objc_msgSend + 244
2 com.apple.Foundation 0x929a7cec _encodeObject + 104
3 com.apple.AppKit 0x93a50a10 -[NSMenuItem encodeWithCoder:] + 1228
4 com.apple.Foundation 0x929a8008 _encodeObject + 900
5 com.apple.Foundation 0x929a8654 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 312
6 com.apple.Foundation 0x929a24fc -[NSArray encodeWithCoder:] + 252
7 com.apple.Foundation 0x929a8008 _encodeObject + 900
8 com.apple.AppKit 0x93a4ed24 -[NSMenu encodeWithCoder:] + 196
9 com.apple.Foundation 0x929a8008 _encodeObject + 900
10 com.apple.AppKit 0x93b6bcbc -[NSSearchFieldCell encodeWithCoder:] + 960
11 com.apple.Foundation 0x929a8008 _encodeObject + 900
12 com.apple.AppKit 0x9382efcc -[NSControl encodeWithCoder:] + 320
13 com.apple.AppKit 0x9382edb4 -[NSTextField encodeWithCoder:] + 64
14 com.apple.AppKit 0x93b6b2d4 -[NSSearchField encodeWithCoder:] + 64
15 com.apple.Foundation 0x929a8008 _encodeObject + 900
16 com.apple.Foundation 0x929a9010 +[NSKeyedArchiver archivedDataWithRootObject:] + 148
17 com.apple.AppKit 0x93b07654 -[NSToolbarItem _copyOfCustomView] + 44
18 com.apple.AppKit 0x93b0772c -[NSToolbarItem copyWithZone:] + 148
19 com.apple.AppKit 0x93b0f1c4 -[NSToolbarView(_ItemDragAndDropSupport) _beginSrcDragItemWithEvent:] + 568
20 com.apple.AppKit 0x93b0c0f8 -[NSToolbarView mouseDown:] + 68
21 com.apple.AppKit 0x93729890 -[NSWindow sendEvent:] + 4616
22 com.apple.AppKit 0x936d28d4 -[NSApplication sendEvent:] + 4172
23 ...iteratureandlatte.scrivener 0x000155d4 -[SCRApplication sendEvent:] + 600 (crt.c:355)
24 com.apple.AppKit 0x936c9d10 -[NSApplication run] + 508
25 com.apple.AppKit 0x937ba87c NSApplicationMain + 452
26 ...iteratureandlatte.scrivener 0x00002b88 _start + 340 (crt.c:272)
27 ...iteratureandlatte.scrivener 0x00002a30 start + 60
Thread 1:
0 libSystem.B.dylib 0x9000b268 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000b1bc mach_msg + 60
2 com.apple.CoreGraphics 0x903d86dc _CGSFlushRegionInline + 156
3 com.apple.CoreGraphics 0x903d805c _CGSFlushWindowRegion + 296
4 com.apple.CoreGraphics 0x903d7ba0 CGSDeviceSynchronize + 552
5 libRIP.A.dylib 0x946ee8dc ripc_Context + 124
6 com.apple.AppKit 0x93717f3c -[NSWindow flushWindow] + 288
7 com.apple.Foundation 0x9294b5e8 -[NSArray makeObjectsPerformSelector:withObject:] + 264
8 com.apple.AppKit 0x9376a9c4 -[NSUIHeartBeat _heartBeatThread:] + 1024
9 com.apple.Foundation 0x92944194 forkThreadForFunction + 108
10 libSystem.B.dylib 0x9002bc28 _pthread_body + 96
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden