Skip to content

Commit 1f6f130

Browse files
committed
Fixed crashes related to dispatch_get_specific() on iOS 4.x, removed a deprecation warning.
1 parent 1e4882b commit 1f6f130

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

framework/Source/GPUImageOutput.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
1818
void runSynchronouslyOnVideoProcessingQueue(void (^block)(void))
1919
{
2020
dispatch_queue_t videoProcessingQueue = [GPUImageContext sharedContextQueue];
21-
22-
if(dispatch_get_specific([GPUImageContext contextKey]))
21+
#if (!defined(__IPHONE_6_0) || (__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_6_0))
22+
if (dispatch_get_current_queue() == videoProcessingQueue)
23+
#else
24+
if (dispatch_get_specific([GPUImageContext contextKey]))
25+
#endif
2326
{
2427
block();
2528
}else
@@ -32,7 +35,11 @@ void runAsynchronouslyOnVideoProcessingQueue(void (^block)(void))
3235
{
3336
dispatch_queue_t videoProcessingQueue = [GPUImageContext sharedContextQueue];
3437

35-
if(dispatch_get_specific([GPUImageContext contextKey]))
38+
#if (!defined(__IPHONE_6_0) || (__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_6_0))
39+
if (dispatch_get_current_queue() == videoProcessingQueue)
40+
#else
41+
if (dispatch_get_specific([GPUImageContext contextKey]))
42+
#endif
3643
{
3744
block();
3845
}else

framework/Source/iOS/GPUImageContext.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ - (id)init;
2727

2828
openGLESContextQueueKey = &openGLESContextQueueKey;
2929
_contextQueue = dispatch_queue_create("com.sunsetlakesoftware.GPUImage.openGLESContextQueue", NULL);
30+
#if (!defined(__IPHONE_6_0) || (__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_6_0))
31+
#else
3032
dispatch_queue_set_specific(_contextQueue, openGLESContextQueueKey, (__bridge void *)self, NULL);
33+
#endif
3134
shaderProgramCache = [[NSMutableDictionary alloc] init];
3235

3336
return self;

framework/Source/iOS/GPUImageMovieWriter.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ - (void)finishRecordingWithCompletionHandler:(void (^)(void))handler;
289289
}
290290
else {
291291
// Not running iOS 6
292+
#pragma clang diagnostic push
293+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
292294
[assetWriter finishWriting];
295+
#pragma clang diagnostic pop
293296
if (handler) handler();
294297
}
295298
#endif

0 commit comments

Comments
 (0)