summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/clipboard/qmacmime.mm
diff options
context:
space:
mode:
authorDyami Caliri <dyami@dragonframe.com>2014-10-29 16:45:33 -0700
committerDyami Caliri <dyami@dragonframe.com>2014-10-30 21:23:37 +0100
commitf3fb787a32aee43441c5802a406f8dbd1eb0a1d6 (patch)
tree51a99d7d1b1178db3364b7d079dcb0524a3c784f /src/platformsupport/clipboard/qmacmime.mm
parentdd6876f3fdeb4b95a24fba4ad48cbf445b8fb9f4 (diff)
OS X: fix CFString leaks in mime classes
Some CFStringRefs created with CFStringCreate* methods were not being released. Using the QCFString helper class to perform auto release. Change-Id: I36d15c0d35118524089e99ea3cd53c41342d6308 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'src/platformsupport/clipboard/qmacmime.mm')
-rw-r--r--src/platformsupport/clipboard/qmacmime.mm9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm
index 27a490335b..6fcd19e07b 100644
--- a/src/platformsupport/clipboard/qmacmime.mm
+++ b/src/platformsupport/clipboard/qmacmime.mm
@@ -48,6 +48,7 @@
#include "qmacmime_p.h"
#include "qguiapplication.h"
+#include "private/qcore_mac_p.h"
QT_BEGIN_NAMESPACE
@@ -335,9 +336,9 @@ QVariant QMacPasteboardMimePlainTextFallback::convertToMime(const QString &mimet
// Note that public.text is documented by Apple to have an undefined encoding. From
// testing it seems that utf8 is normally used, at least by Safari on iOS.
const QByteArray &firstData = data.first();
- return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
+ return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), kCFStringEncodingUTF8, false));
+ firstData.size(), kCFStringEncodingUTF8, false)));
} else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
}
@@ -410,9 +411,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
// I can only handle two types (system and unicode) so deal with them that way
QVariant ret;
if (flavor == QLatin1String("public.utf8-plain-text")) {
- ret = QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
+ ret = QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), CFStringGetSystemEncoding(), false));
+ firstData.size(), CFStringGetSystemEncoding(), false)));
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
ret = QString(reinterpret_cast<const QChar *>(firstData.constData()),
firstData.size() / sizeof(QChar));