diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-03-21 13:48:18 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-03 11:07:07 +0200 |
commit | 66178447e91f56eaeaee203171b9355399d3bb5c (patch) | |
tree | 9683a9abb5a845efbb6bcc90ca69853ddc175294 /src | |
parent | d6202762c135fbf5f1242911cf2455ff687f328e (diff) |
Mac: Use QString::toNSString in QtBase.
The string is now autoreleased.
This fixes a memory leak in qt_mac_QStringListToNSMutableArrayVoid
Task-number: QTBUG-20347
Change-Id: I11ebeb264af4c8ce98968f2221eea772f24c12d4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_fsevents.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuloader.mm | 3 |
3 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index bfcae2a3a2..981d663694 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -478,7 +478,7 @@ bool QFseventsFileSystemWatcherEngine::startStream() NSMutableArray *pathsToWatch = [NSMutableArray arrayWithCapacity:watchedPaths.size()]; for (PathRefCounts::const_iterator i = watchedPaths.begin(), ei = watchedPaths.end(); i != ei; ++i) - [pathsToWatch addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(i.key()))]; + [pathsToWatch addObject:i.key().toNSString()]; struct FSEventStreamContext callBackInfo = { 0, diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index a73944c07c..9850f83dea 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -74,7 +74,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list) { NSMutableArray *result = [NSMutableArray arrayWithCapacity:list.size()]; for (int i=0; i<list.size(); ++i){ - [result addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(list[i]))]; + [result addObject:list[i].toNSString()]; } return result; } diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index 29fc0fb674..60bc3b5a55 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -115,14 +115,13 @@ QT_END_NAMESPACE showAllItem = [[appMenu itemWithTitle:@"Show All"] retain]; // Get the names in the nib to match the app name set by Qt. - const NSString *appName = reinterpret_cast<const NSString*>(QCFString::toCFStringRef(qt_mac_applicationName())); + const NSString *appName = qt_mac_applicationName().toNSString(); [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication" withString:const_cast<NSString *>(appName)]]; [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication" withString:const_cast<NSString *>(appName)]]; [aboutItem setTitle:[[aboutItem title] stringByReplacingOccurrencesOfString:@"NewApplication" withString:const_cast<NSString *>(appName)]]; - [appName release]; // Disable the items that don't do anything. If someone associates a QAction with them // They should get synced back in. [preferencesItem setEnabled:NO]; |