From 705ebaea0d81c76c97e7230f0acbe85442981555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 12 Jan 2010 09:05:13 +0100 Subject: Add an autorelease pool to QApplication instance. This will catch releases done between creating the QApplication object and calling QApplication::exec. (The Cocoa event loop creates release pools for us when it's running.) The memory used by the objects stored in this pool won't be released until the QApplication instance is deleted at application exit. Because of this it still makes sense to still add local release pools when doing potentially large allocations. --- src/gui/kernel/qapplication_p.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 14d7215..fc9e1ab 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -74,6 +74,9 @@ #ifdef Q_OS_SYMBIAN #include #endif +#ifdef Q_WS_MAC +#include +#endif QT_BEGIN_NAMESPACE @@ -481,6 +484,13 @@ public: static Qt::NavigationMode navigationMode; #endif +// We need to have an autorelease pool in place in order +// to catch releases done in between creating the QApplication +// instance and calling QApplicaiton::exec(); +#if defined(QT_MAC_USE_COCOA) + QMacCocoaAutoReleasePool pool; +#endif + #if defined(Q_WS_MAC) || defined(Q_WS_X11) void _q_alertTimeOut(); QHash alertTimerHash; -- cgit v0.12