mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-29 00:50:40 +00:00
Fixed GCD objects under ARC on OS X 10.7
This commit is contained in:
parent
f12e8fb1ea
commit
fd447230d7
@ -8,31 +8,23 @@
|
||||
|
||||
#import <MTProtoKit/MTTimer.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
|
||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
|
||||
#else // iOS 5.X or earlier
|
||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
|
||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
|
||||
#else
|
||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@interface MTTimer ()
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
@property (nonatomic, strong) dispatch_source_t timer;
|
||||
#else
|
||||
@property (nonatomic) dispatch_source_t timer;
|
||||
#endif
|
||||
|
||||
@property (nonatomic) NSTimeInterval timeout;
|
||||
@property (nonatomic) bool repeat;
|
||||
@property (nonatomic, copy) dispatch_block_t completion;
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
@property (nonatomic, strong) dispatch_queue_t queue;
|
||||
#else
|
||||
@property (nonatomic) dispatch_queue_t queue;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@ -48,7 +40,10 @@
|
||||
_timeout = timeout;
|
||||
_repeat = repeat;
|
||||
self.completion = completion;
|
||||
self.queue = queue;
|
||||
#if !OS_OBJECT_USE_OBJC
|
||||
dispatch_retain(queue);
|
||||
#endif
|
||||
_queue = queue;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -58,11 +53,19 @@
|
||||
if (_timer != nil)
|
||||
{
|
||||
dispatch_source_cancel(_timer);
|
||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||
#if !OS_OBJECT_USE_OBJC
|
||||
dispatch_release(_timer);
|
||||
#endif
|
||||
_timer = nil;
|
||||
}
|
||||
|
||||
if (_queue != nil)
|
||||
{
|
||||
#if !OS_OBJECT_USE_OBJC
|
||||
dispatch_release(_queue);
|
||||
#endif
|
||||
_queue = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)start
|
||||
@ -99,7 +102,7 @@
|
||||
if (_timer != nil)
|
||||
{
|
||||
dispatch_source_cancel(_timer);
|
||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||
#if !OS_OBJECT_USE_OBJC
|
||||
dispatch_release(_timer);
|
||||
#endif
|
||||
_timer = nil;
|
||||
|
@ -1783,7 +1783,7 @@
|
||||
"$(PROJECT_DIR)/openssl",
|
||||
"$(PROJECT_DIR)/openssl/OSX",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = MTProtoKit;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = framework;
|
||||
@ -1817,7 +1817,7 @@
|
||||
"$(PROJECT_DIR)/openssl",
|
||||
"$(PROJECT_DIR)/openssl/OSX",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = MTProtoKit;
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = framework;
|
||||
|
Loading…
x
Reference in New Issue
Block a user