Re: NSMenuItem's selectors messages not sent
Re: NSMenuItem's selectors messages not sent
- Subject: Re: NSMenuItem's selectors messages not sent
- From: Lorenzo Thurman <email@hidden>
- Date: Tue, 1 Sep 2009 10:08:53 -0500
I don't have GC turned on, I checked and they are not set to auto-enable. I
added this to see if the message is even being dispatched and the target
message is never sent: [[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(itemSelected:)
name:NSMenuWillSendActionNotification object:[NSApp mainMenu]]; My app
already subscribes to NSMenuDidEndTrackingNotification and its target
message is still sent, so there's something wonky with my menu items. The
menu items are added dynamically in response to user events. I initialize
the menu items in my init method and add them to the menu later. This all
worked just fine in 10.4 and 10.5. I was inclined to think there was a bug
in 10.6 that caused this, but I can't google any other similar issues. If I
inspect the menu items is gdb, they all seem to be configured correctly. The
parent menu is valid, the target(delegate) is valid, etc. I guess I'll have
to keep looking until I find out what's going on. Thanks for the reply.
On Mon, Aug 31, 2009 at 6:44 PM, Steven Degutis <email@hidden>wrote:
> Lorenzo,
> My first guess would be that you must have turned on garbage collection at
> some point, and have a controller object that's not strongly referenced by
> other objects, floating about in your NIB. If this is the case, the object
> would deallocate pretty soon after your NIB loads, and no messages
> associated with your menu items would get sent.
>
> However, when menu items can find no targets matching their selector in the
> responder chain, they usually are disabled, rather than enabled and doing
> nothing. However, if you don't have them set to auto-enable themselves, this
> isn't the case.
>
> In any event, you can use gdb to trace the program's execution flow to find
> out exactly when certain things are happening, and put breakpoints on
> questionable lines of code.
>
> --
> Steven Degutis
> http://www.thoughtfultree.com/
> http://www.degutis.org/
>
>
> On Mon, Aug 31, 2009 at 4:20 PM, Lorenzo Thurman <email@hidden>wrote:
>
>> I have two applications, both NSStatusItems. Upon upgrading to Snow
>> Leopard
>> (from 10.5), I've found that none of the messages associated with the menu
>> items are called. As near as I can tell, the messages are never
>> dispatched,
>> at least the breakpoints in the methods are never hit. I can't find
>> anything
>> in the release notes to provide a clue. Can someone provide me with some
>> guidance as to what may be wrong? And as a side note, how can I use the
>> debugger to detemine if a message is even dispatched.Thanks
>>
>> --
>> "My break-dancing days are over, but there's always the funky chicken"
>> --The Full Monty
>> _______________________________________________
>>
>> 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
>>
>
>
>
>
--
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
_______________________________________________
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