diff options
author | Chris Meyer <cmeyer1969@gmail.com> | 2012-10-12 10:46:25 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-20 07:54:14 +0100 |
commit | d1f2309166295f2669df7d7f8ee996e35b35aa3c (patch) | |
tree | 602678a866c8759866170d2db26e7476941f170e /src/plugins/platforms/cocoa/qcocoamenuloader.mm | |
parent | 865a5f0cdad0a481e998c1f09a65f2896683712d (diff) |
Fix duplicated application menu items on Mac OS
Added code to check to see if the menu item already exists in the
application menu before adding it.
Change-Id: Ie0a5eab3c61d5a3413a834d2e57bab40660f6802
Task-number: QTBUG-27202
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenuloader.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuloader.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index 2a9dcec64b..726fe5c6d2 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -246,11 +246,17 @@ QT_END_NAMESPACE return [[hideItem retain] autorelease]; } -- (NSMenuItem *)appSpecificMenuItem +- (NSMenuItem *)appSpecificMenuItem:(NSInteger)tag { + NSMenuItem *item = [appMenu itemWithTag:tag]; + + // No reason to create the item if it already exists. See QTBUG-27202. + if (item) + return [[item retain] autorelease]; + // Create an App-Specific menu item, insert it into the menu and return // it as an autorelease item. - NSMenuItem *item = [[NSMenuItem alloc] init]; + item = [[NSMenuItem alloc] init]; NSInteger location; if (lastAppSpecificItem == nil) { |