diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-25 13:56:27 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-25 14:26:32 (GMT) |
commit | f405a89621b4bfe957d7e0e4d321a9ea0931d34b (patch) | |
tree | b8e1613664e15c8d557ff8fd66d178da4ca33517 /src/gui/kernel/qt_cocoa_helpers_mac.mm | |
parent | df4d9f46e370a35c3178d95cae2a873e8a23ddb5 (diff) | |
download | Qt-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
Diffstat (limited to 'src/gui/kernel/qt_cocoa_helpers_mac.mm')
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 13 |
1 files changed, 13 insertions, 0 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 |