From 705cdf11fc4826393b175744c044b7f265dcd240 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 2 Mar 2015 17:50:23 +0100 Subject: [PATCH] Move ScopedNSAutoreleasePool to ext --- debian/copyright | 2 +- ext/clementine-spotifyblob/spotify_utilities.mm | 12 ++++++------ ext/libclementine-common/CMakeLists.txt | 4 ++++ .../core/scoped_nsautorelease_pool.h | 0 .../core/scoped_nsautorelease_pool.mm | 0 src/CMakeLists.txt | 1 - 6 files changed, 11 insertions(+), 8 deletions(-) rename {src => ext/libclementine-common}/core/scoped_nsautorelease_pool.h (100%) rename {src => ext/libclementine-common}/core/scoped_nsautorelease_pool.mm (100%) diff --git a/debian/copyright b/debian/copyright index 8919c5b2a..be85ba92d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -46,9 +46,9 @@ Copyright: 2004, Melchior FRANZ License: GPL-2+ Files: ext/libclementine-common/core/arraysize.h + ext/libclementine-common/core/scoped_nsautorelease_pool.* src/core/scoped_nsobject.h src/core/scoped_cftyperef.h - src/core/scoped_nsautorelease_pool.* Copyright: 2011, The Chromium Authors License: BSD-Google diff --git a/ext/clementine-spotifyblob/spotify_utilities.mm b/ext/clementine-spotifyblob/spotify_utilities.mm index b8a564b9b..ffde37e9a 100644 --- a/ext/clementine-spotifyblob/spotify_utilities.mm +++ b/ext/clementine-spotifyblob/spotify_utilities.mm @@ -4,11 +4,12 @@ #import #import +#import "core/scoped_nsautorelease_pool.h" + namespace utilities { QString GetUserDataDirectory() { - NSAutoreleasePool* pool = [NSAutoreleasePool alloc]; - [pool init]; + ScopedNSAutoreleasePool pool; NSArray* paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); @@ -19,12 +20,11 @@ QString GetUserDataDirectory() { } else { ret = "~/Library/Caches"; } - [pool drain]; return ret; } QString GetSettingsDirectory() { - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + ScopedNSAutoreleasePool pool; NSArray* paths = NSSearchPathForDirectoriesInDomains( NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString* ret; @@ -42,7 +42,7 @@ QString GetSettingsDirectory() { error:nil]; QString path = QString::fromUtf8([ret UTF8String]); - [pool drain]; return path; } -} + +} // namespace utilities diff --git a/ext/libclementine-common/CMakeLists.txt b/ext/libclementine-common/CMakeLists.txt index db5b4c0aa..6b45be6a9 100644 --- a/ext/libclementine-common/CMakeLists.txt +++ b/ext/libclementine-common/CMakeLists.txt @@ -21,6 +21,10 @@ set(HEADERS core/workerpool.h ) +if(APPLE) + list(APPEND SOURCES core/scoped_nsautorelease_pool.mm) +endif(APPLE) + qt4_wrap_cpp(MOC ${HEADERS}) add_library(libclementine-common STATIC diff --git a/src/core/scoped_nsautorelease_pool.h b/ext/libclementine-common/core/scoped_nsautorelease_pool.h similarity index 100% rename from src/core/scoped_nsautorelease_pool.h rename to ext/libclementine-common/core/scoped_nsautorelease_pool.h diff --git a/src/core/scoped_nsautorelease_pool.mm b/ext/libclementine-common/core/scoped_nsautorelease_pool.mm similarity index 100% rename from src/core/scoped_nsautorelease_pool.mm rename to ext/libclementine-common/core/scoped_nsautorelease_pool.mm diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 661b5a843..4a80c5994 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -864,7 +864,6 @@ optional_source(APPLE core/macfslistener.mm core/macglobalshortcutbackend.mm core/mac_startup.mm - core/scoped_nsautorelease_pool.mm devices/macdevicelister.mm engines/osxdevicefinder.cpp networkremote/bonjour.mm