diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-01-12 08:05:13 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-01-12 08:05:13 (GMT) |
commit | 705ebaea0d81c76c97e7230f0acbe85442981555 (patch) | |
tree | 0689841ffbb512333154b51149ce42ce1e948adb /src/gui/kernel | |
parent | 58112b1e251c03b0a72511508712f9a67ce84d25 (diff) | |
download | Qt-705ebaea0d81c76c97e7230f0acbe85442981555.zip Qt-705ebaea0d81c76c97e7230f0acbe85442981555.tar.gz Qt-705ebaea0d81c76c97e7230f0acbe85442981555.tar.bz2 |
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.
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 <w32std.h> #endif +#ifdef Q_WS_MAC +#include <private/qt_mac_p.h> +#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<QWidget *, QTimer *> alertTimerHash; |