summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-07-21 18:03:27 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-07-22 20:07:58 +0000
commit8ea51f8aaa426fa14393b83082f9eec076d7d72a (patch)
tree1eab4329fa9910ae5456e7c6ca3b5388494547f4 /src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
parent4bbcc054e03152923938adbd610e954578741755 (diff)
Make QCocoaMenuLoader a singleton
In some auto-tests, we create several instances of QGuiApplication (though seldom, if ever, simultaneously). However, the QCocoaMenuLoader instance was never properly deallocated, resulting in NSApplication.servicesMenu to still be assigned. This resulted in an exception being raised (NSInternalInconsistencyException) the second time we would construct a QCocoaMenuLoader. The CPU cycles saving solution is to make QCocoaMenuLoader a singleton. This approach is also safe since this class' initialization doesn't depend on any state in QGuiApplication (even the application name is fetched from either the main bundle or the app's args). This also allows us to clean up some code in QCocoaApplication and QCocoaApplicationDelegate who have suffered from lack of attention over the years. Change-Id: Ic4c859d628ab8abd9b469b99c64293582f8e363d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
index 68a028ed8a..68ee92ad05 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
@@ -95,7 +95,6 @@
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate> {
bool startedQuit;
NSMenu *dockMenu;
- QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
NSObject <NSApplicationDelegate> *reflectionDelegate;
bool inLaunch;
}