• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does this crash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does this crash?


  • Subject: Re: Why does this crash?
  • From: Andre <email@hidden>
  • Date: Mon, 2 Jan 2006 17:33:17 -0800


On 平成 18/01/02, at 16:44, Shawn Erickson wrote:


On Jan 2, 2006, at 4:39 PM, email@hidden wrote:

In a simple subclass of NSPopUpButtonCell, this is the only subclassed method, set to the custom cell in a NSTableColumn.
The table column is using bindings BTW...


I'm wondering why this would crash? I need to get the title of the selected item because of a "possible" bug in NSPopUpButtonCell....

- (NSMenu *)menu
{
	 NSMenu *returnMenu = [super menu];

//I want to grab the cell's title currently selected, not whats selected by the menu during pop-up
NSLog(@"titleOfSelectedItem is %@",[self titleOfSelectedItem]); // Crash and burn

return returnMenu;
}


Calling [self title] does not crash BTW.

What does the crash look like? Maybe you are getting into a recursive loop because titleOfSelectedItem internally calls [self menu].
At startup, I guess you right, its recursively calling [self menu] like so: (up to 87214 stack frames then blows up)

#0 0x00212d08 in -[ConsistentPopUpButtonCell menu] at ConsistentPopUpButtonCell.m:25
#1 0x00212dcc in -[ConsistentPopUpButtonCell menu] at ConsistentPopUpButtonCell.m:31
#2 0x93786fb4 in -[NSPopUpButtonCell itemAtIndex:]
#3 0x00212dcc in -[ConsistentPopUpButtonCell menu] at ConsistentPopUpButtonCell.m:31


So I can actually, it turns out call [self title], or call it in a different method, or put a lock somewhere to stop any recursion...

Thanks much.

Andre

_______________________________________________
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


References: 
 >Why does this crash? (From: email@hidden)
 >Re: Why does this crash? (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: newbie help loading arrays programatically
  • Next by Date: Getting the contentValues of an NSPopUpButtonCell
  • Previous by thread: Re: Why does this crash?
  • Next by thread: Re: newbie help loading arrays programatically
  • Index(es):
    • Date
    • Thread