diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2015-02-26 13:00:39 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2015-02-26 12:11:33 +0000 |
commit | 9608629d7ee42dd65437d2e7fad5c91438d7de4b (patch) | |
tree | b2a26e31fcf0ec0b24c243a3b40ae7773f858dc5 /src/widgets/styles/qmacstyle_mac.mm | |
parent | b7d4e4ffebf91ff539e705abef9941073667f373 (diff) |
OSX: fix leaks due to missing NSAutoreleasePool
env OBJC_DEBUG_MISSING_POOLS=YES qtcreator
Change-Id: Ibbe5f42af5b94a439be3f0dd0f2b6e34bb1afd3f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 394d06843b..4f9ed2c325 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -93,6 +93,18 @@ 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; } @@ -2122,6 +2134,8 @@ QMacStyle::QMacStyle() : QCommonStyle(*new QMacStylePrivate) { Q_D(QMacStyle); + AutoReleasePool pool; + d->receiver = [[NotificationReceiver alloc] initWithPrivate:d]; NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver); @@ -2137,6 +2151,8 @@ QMacStyle::QMacStyle() QMacStyle::~QMacStyle() { Q_D(QMacStyle); + AutoReleasePool pool; + [reinterpret_cast<NSScroller*>(d->nsscroller) release]; NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver); @@ -2152,6 +2168,7 @@ QMacStyle::~QMacStyle() */ QPixmap QMacStylePrivate::generateBackgroundPattern() const { + AutoReleasePool pool; QPixmap px(4, 4); QMacCGContext cg(&px); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal); @@ -2749,6 +2766,8 @@ QPalette QMacStyle::standardPalette() const int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const { + AutoReleasePool pool; + SInt32 ret = 0; switch (sh) { case SH_Slider_SnapToValue: |