summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-04-17 11:27:43 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-18 15:31:29 +0200
commitb381581579e2e49f5f8211bf4260a141e0642cd2 (patch)
tree4b5fb42375a4359ce29ea8f9b1e1c3e4e9f1d8af /src
parent2bd846f8da8c6e8c61539f2cc986df4602e5d80e (diff)
downloadqtbase-b381581579e2e49f5f8211bf4260a141e0642cd2.tar.gz
Mac: Fix various memory leaks
Change-Id: Id554be11ffcf9a506c217b0dc5b96cb37c4dd57c Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemsettings.mm4
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm1
4 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index e2d867e623..821e10de52 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -122,7 +122,9 @@ void QCocoaScreen::updateGeometry()
m_physicalSize = QSizeF(size.width, size.height);
m_logicalDpi.first = 72;
m_logicalDpi.second = 72;
- float refresh = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(dpy));
+ CGDisplayModeRef displayMode = CGDisplayCopyDisplayMode(dpy);
+ float refresh = CGDisplayModeGetRefreshRate(displayMode);
+ CGDisplayModeRelease(displayMode);
if (refresh > 0)
m_refreshRate = refresh;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 732851ecf7..bde9ded14f 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -323,7 +323,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
// typical use-case for a choice list, or non-editable combobox. We can't
// re-use the popUpContextMenu:withEvent:forView: logic below since it won't
// respect the menu's minimum width.
- NSPopUpButtonCell *popupCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
+ NSPopUpButtonCell *popupCell = [[[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]
+ autorelease];
[popupCell setAltersStateOfSelectedItem:NO];
[popupCell setTransparent:YES];
[popupCell setMenu:m_nativeMenu];
@@ -350,7 +351,6 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
eventNumber:0
clickCount:1
pressure:1.0];
- NSSize size = m_nativeMenu.size;
[NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view];
}
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
index e613dbbd1b..af817bd4c5 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
@@ -176,7 +176,7 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
QHash<QPlatformTheme::Palette, QPalette*> palettes;
QColor qc;
for (int i = 0; mac_widget_colors[i].paletteRole != QPlatformTheme::NPalettes; i++) {
- QPalette pal = *qt_mac_createSystemPalette();
+ QPalette &pal = *qt_mac_createSystemPalette();
if (mac_widget_colors[i].active != 0) {
qc = qt_mac_colorForThemeTextColor(mac_widget_colors[i].active);
pal.setColor(QPalette::Active, QPalette::Text, qc);
@@ -223,7 +223,7 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
pal.setBrush(QPalette::Disabled, QPalette::Base,
pal.brush(QPalette::Active, QPalette::Base));
}
- palettes.insert(mac_widget_colors[i].paletteRole, new QPalette(pal));
+ palettes.insert(mac_widget_colors[i].paletteRole, &pal);
}
return palettes;
}
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 04fea3ec47..c9cc56b101 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1785,6 +1785,7 @@ QMacStyle::~QMacStyle()
NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver);
[[NSNotificationCenter defaultCenter] removeObserver:receiver];
+ [receiver release];
}
#endif