Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Won't compile with ARC on OS X 10.8 and iOS 6 with dispatch_release #89

Merged
merged 1 commit into from

2 participants

@g-Off

Under ARC dispatch queues no longer need to be released via dispatch_release and doing so is a compiler error. I've added a macro that will only call dispatch_release if necessary.

@ccgus
Owner

What build settings and version of Xcode are you using? I'm on 10.8 + Xcode 4.4 (building against the 10.8 SDK) and I don't get any errors- so I don't see why the patch is needed.

@g-Off

Looks like setting the deployment target to 10.8 or iOS 6 is the cause of the build error.

@ccgus ccgus merged commit 5890f1a into ccgus:master
@ccgus
Owner

Thanks for the patches!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 2 deletions.
  1. +22 −0 src/FMDatabase.h
  2. +1 −1  src/FMDatabasePool.m
  3. +1 −1  src/FMDatabaseQueue.m
View
22 src/FMDatabase.h
@@ -12,6 +12,8 @@
#define FMDBReturnRetained FMDBRetain
#define FMDBRelease(__v) ([__v release]);
+
+ #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v));
#else
// -fobjc-arc
#define FMDBAutorelease(__v)
@@ -21,6 +23,26 @@
#define FMDBReturnRetained(__v) (__v)
#define FMDBRelease(__v)
+
+ #if TARGET_OS_IPHONE
+ // Compiling for iOS
+ #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
+ // iOS 6.0 or later
+ #define FMDBDispatchQueueRelease(__v)
+ #else
+ // iOS 5.X or earlier
+ #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v));
+ #endif
+ #else
+ // Compiling for Mac OS X
+ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+ // Mac OS X 10.8 or later
+ #define FMDBDispatchQueueRelease(__v)
+ #else
+ // Mac OS X 10.7 or earlier
+ #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v));
+ #endif
+ #endif
#endif
View
2  src/FMDatabasePool.m
@@ -49,7 +49,7 @@ - (void)dealloc {
FMDBRelease(_databaseOutPool);
if (_lockQueue) {
- dispatch_release(_lockQueue);
+ FMDBDispatchQueueRelease(_lockQueue);
_lockQueue = 0x00;
}
#if ! __has_feature(objc_arc)
View
2  src/FMDatabaseQueue.m
@@ -59,7 +59,7 @@ - (void)dealloc {
FMDBRelease(_path);
if (_queue) {
- dispatch_release(_queue);
+ FMDBDispatchQueueRelease(_queue);
_queue = 0x00;
}
#if ! __has_feature(objc_arc)
Something went wrong with that request. Please try again.