зеркало из https://github.com/mozilla/pjs.git
fix memory leak and key modifier issues with last checkin for Cocoa menus. b=316076
This commit is contained in:
Родитель
447bedba3c
Коммит
9d1e7f0b1c
|
@ -571,7 +571,7 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsIMenu* inMenu, const nsAString
|
|||
|
||||
// Get more information about the key equivalent. Start by
|
||||
// finding the key node we need.
|
||||
NSString* keyEquiv = @"";
|
||||
NSString* keyEquiv = [@"" retain];
|
||||
unsigned int macKeyModifiers;
|
||||
nsCOMPtr<nsIDOMElement> keyElement;
|
||||
domdoc->GetElementById(key, getter_AddRefs(keyElement));
|
||||
|
@ -583,6 +583,8 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsIMenu* inMenu, const nsAString
|
|||
if (!keyChar.EqualsLiteral(" ")) {
|
||||
keyEquiv = (NSString*)::CFStringCreateWithCharacters(kCFAllocatorDefault, (UniChar*)keyChar.get(),
|
||||
keyChar.Length());
|
||||
[keyEquiv autorelease];
|
||||
keyEquiv = [[keyEquiv lowercaseString] retain];
|
||||
}
|
||||
// now grab the key equivalent modifiers
|
||||
nsAutoString modifiersStr;
|
||||
|
@ -597,6 +599,7 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsIMenu* inMenu, const nsAString
|
|||
NSMenuItem* newMenuItem = [[NSMenuItem alloc] initWithTitle:labelString action:action keyEquivalent:keyEquiv];
|
||||
|
||||
[labelString release];
|
||||
[keyEquiv release];
|
||||
|
||||
[newMenuItem setTag:tag];
|
||||
[newMenuItem setTarget:target];
|
||||
|
|
Загрузка…
Ссылка в новой задаче