summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-01-25 13:56:27 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-01-25 14:26:32 (GMT)
commitf405a89621b4bfe957d7e0e4d321a9ea0931d34b (patch)
treeb8e1613664e15c8d557ff8fd66d178da4ca33517
parentdf4d9f46e370a35c3178d95cae2a873e8a23ddb5 (diff)
downloadQt-f405a89621b4bfe957d7e0e4d321a9ea0931d34b.zip
Qt-f405a89621b4bfe957d7e0e4d321a9ea0931d34b.tar.gz
Qt-f405a89621b4bfe957d7e0e4d321a9ea0931d34b.tar.bz2
Cocoa: Usage of QMacCocoaAutoReleasePool makes CPU peak
The reason was that QMacCocoaAutoReleasePool included a a call to NSApplicationLoad(). This call should only be made for carbon based application anyway, so we just ifdef it out (event how clumsy the placing of the call is). The CPU problem came because after the call, [NSApp isRunning] would return true, an as such, confuse the event dispatcher later on. Reviewed-by: MortenS
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm13
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm13
2 files changed, 13 insertions, 13 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index e36ab9b..e85a716 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1278,4 +1278,17 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor)
}
#endif
+QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
+{
+#ifndef QT_MAC_USE_COCOA
+ NSApplicationLoad();
+#endif
+ pool = (void*)[[NSAutoreleasePool alloc] init];
+}
+
+QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool()
+{
+ [(NSAutoreleasePool*)pool release];
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index ae805f6..0265a83 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -569,16 +569,3 @@ private:
}
@end
-
-/* Done here because this is the only .mm for now! -Sam */
-QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
-{
- NSApplicationLoad();
- pool = (void*)[[NSAutoreleasePool alloc] init];
-}
-
-QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool()
-{
- [(NSAutoreleasePool*)pool release];
-}
-