I have a custom cell with a popup as part of the cell. To implement
the popup, my custom cell maintains an NSPopUpCell and then at the
appropriate times just calls [NSPopUpCell
performClickWithFrame:inView:] to display the popup menu. Very simple.
The only problem is, sometimes it crashes.
#0 0x7fff88a743f8 in objc_msgSend_vtable5
#1 0x7fff816d0623 in -[NSMenu _enableItem:]
#2 0x7fff816d0408 in -[NSCarbonMenuImpl
_carbonUpdateStatusEvent:handlerCallRef:]
#3 0x7fff816b3d08 in NSSLMMenuEventHandler
#4 0x7fff837b1f97 in DispatchEventToHandlers
#5 0x7fff837b14e6 in SendEventToEventTargetInternal
#6 0x7fff837cef49 in SendEventToEventTarget
#7 0x7fff837fdf59 in SendHICommandEvent
#8 0x7fff8381138b in UpdateHICommandStatusWithCachedEvent
#9 0x7fff837adec5 in HIApplication::EventHandler
#10 0x7fff837b1f97 in DispatchEventToHandlers
#11 0x7fff837b14e6 in SendEventToEventTargetInternal
#12 0x7fff837cef49 in SendEventToEventTarget
#13 0x7fff838109ff in SendMenuOpening
#14 0x7fff83933242 in PopUpMenuSelectCore
#15 0x7fff83933823 in _HandlePopUpMenuSelection7
#16 0x7fff8180383b in _NSSLMPopUpCarbonMenu3
#17 0x7fff819b239a in -[NSPopUpButtonCell
trackMouse:inRect:ofView:untilMouseUp:]
-- [popupCell performClickWithFrame:mLastCellFrame inView:[self
controlView]]; --
The menu and all of its menu items aren't shared with any other
instance of any class. They're created in the init method for my
custom cell and attached to the popup cell.
NSMenu * menu = [[NSMenu alloc] initWithTitle:@""];
[menu addItemWithTitle:NSLocalizedString(@"blah", nil)
action:@selector(blah:) keyEquivalent:@""];
...
popupCell = [[NSPopUpButtonCell alloc] init];
[popupCell setMenu:menu];
[menu release];
With NSZombieEnabled, I see...
-[MyCustomCell respondsToSelector:]: message sent to deallocated
instance 0x117b1edf0
But what doesn't make any sense is how NSMenu[Item] knows about
MyCustomCell in the first place, particularly a deallocated instance.
I thought it must be getting it from the control view passed in to
performClickWithFrame:inView:, so I checked [[self controlView] cell]
and [[self controlView] selectedCell]. The former is nil, and the
latter is the valid instance which is making the call to performClick.
So where is this deallocated instance coming from?
Any ideas?
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]