diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-25 14:56:27 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-25 15:26:32 +0100 |
commit | f405a89621b4bfe957d7e0e4d321a9ea0931d34b (patch) | |
tree | b8e1613664e15c8d557ff8fd66d178da4ca33517 /src/gui | |
parent | df4d9f46e370a35c3178d95cae2a873e8a23ddb5 (diff) | |
download | qt4-tools-f405a89621b4bfe957d7e0e4d321a9ea0931d34b.tar.gz |
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
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 13 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon_mac.mm | 13 |
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 e36ab9b209..e85a7165c5 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 ae805f6790..0265a8372a 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]; -} - |