Bug 390707. Don't leak mNativeMenuItem, fixes wicked Mac crash. patch by jag, r=hwaara,josh,sr=vlad

This commit is contained in:
roc+@cs.cmu.edu 2007-08-07 15:00:36 -07:00
parent 1b132c0201
commit 5b4693aaa4

View File

@ -297,6 +297,7 @@ nsresult nsMenuX::AddMenu(nsIMenu * aMenu)
PRBool enabled;
aMenu->GetEnabled(&enabled);
NSString *newCocoaLabelString = MenuHelpersX::CreateTruncatedCocoaLabel(label);
[mNativeMenuItem release];
mNativeMenuItem = [[NSMenuItem alloc] initWithTitle:newCocoaLabelString action:nil keyEquivalent:@""];
[mNativeMenuItem setEnabled:enabled];
[mMacMenu addItem:mNativeMenuItem];