diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-05-22 14:01:59 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-05-27 18:45:29 +0000 |
commit | 547141352242f7f4eebc6814af7a5ea0f3dff5f8 (patch) | |
tree | ae99a717d91c073653426e16d01fa4767857ff66 /src/widgets/styles/qmacstyle_mac.mm | |
parent | 5f21aa22fbc224cdd4102ae6a7797574a463af3b (diff) |
Add shared implementation of a NSAutoreleasePool wrapper to qglobal
We have at least 5 different (but equal) implementations of a wrapper
in Qt, and some code uses explicit NSAutoreleasePools. Having a shared
implementation lets us clean up things a bit and makes it easier to
reason about which pools are actually needed.
Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 67970ba33d..50c8fd7ed8 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -93,18 +93,6 @@ QT_USE_NAMESPACE -namespace { -class AutoReleasePool -{ -public: - AutoReleasePool(): pool([[NSAutoreleasePool alloc] init]) {} - ~AutoReleasePool() { [pool release]; } - -private: - NSAutoreleasePool *pool; -}; -} - @interface QT_MANGLE_NAMESPACE(NotificationReceiver) : NSObject { QMacStylePrivate *mPrivate; } @@ -1753,7 +1741,7 @@ QMacStylePrivate::QMacStylePrivate() QMacStylePrivate::~QMacStylePrivate() { - AutoReleasePool pool; + QMacAutoReleasePool pool; Q_FOREACH (NSView *b, cocoaControls) [b release]; } @@ -2135,7 +2123,7 @@ QMacStyle::QMacStyle() : QCommonStyle(*new QMacStylePrivate) { Q_D(QMacStyle); - AutoReleasePool pool; + QMacAutoReleasePool pool; d->receiver = [[NotificationReceiver alloc] initWithPrivate:d]; NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver); @@ -2152,7 +2140,7 @@ QMacStyle::QMacStyle() QMacStyle::~QMacStyle() { Q_D(QMacStyle); - AutoReleasePool pool; + QMacAutoReleasePool pool; [reinterpret_cast<NSScroller*>(d->nsscroller) release]; @@ -2169,7 +2157,7 @@ QMacStyle::~QMacStyle() */ QPixmap QMacStylePrivate::generateBackgroundPattern() const { - AutoReleasePool pool; + QMacAutoReleasePool pool; QPixmap px(4, 4); QMacCGContext cg(&px); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal); @@ -2767,7 +2755,7 @@ QPalette QMacStyle::standardPalette() const int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const { - AutoReleasePool pool; + QMacAutoReleasePool pool; SInt32 ret = 0; switch (sh) { |