Skip to content

Commit

Permalink
Fixed crashes related to dispatch_get_specific() on iOS 4.x, removed …
Browse files Browse the repository at this point in the history
…a deprecation warning.
  • Loading branch information
BradLarson committed Jun 3, 2013
1 parent 1e4882b commit 1f6f130
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 10 additions & 3 deletions framework/Source/GPUImageOutput.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
void runSynchronouslyOnVideoProcessingQueue(void (^block)(void))
{
dispatch_queue_t videoProcessingQueue = [GPUImageContext sharedContextQueue];

if(dispatch_get_specific([GPUImageContext contextKey]))
#if (!defined(__IPHONE_6_0) || (__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_6_0))
if (dispatch_get_current_queue() == videoProcessingQueue)
#else
if (dispatch_get_specific([GPUImageContext contextKey]))
#endif
{
block();
}else
Expand All @@ -32,7 +35,11 @@ void runAsynchronouslyOnVideoProcessingQueue(void (^block)(void))
{
dispatch_queue_t videoProcessingQueue = [GPUImageContext sharedContextQueue];

if(dispatch_get_specific([GPUImageContext contextKey]))
#if (!defined(__IPHONE_6_0) || (__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_6_0))
if (dispatch_get_current_queue() == videoProcessingQueue)
#else
if (dispatch_get_specific([GPUImageContext contextKey]))
#endif
{
block();
}else
Expand Down
3 changes: 3 additions & 0 deletions framework/Source/iOS/GPUImageContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ - (id)init;

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

return self;
Expand Down
3 changes: 3 additions & 0 deletions framework/Source/iOS/GPUImageMovieWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ - (void)finishRecordingWithCompletionHandler:(void (^)(void))handler;
}
else {
// Not running iOS 6
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[assetWriter finishWriting];
#pragma clang diagnostic pop
if (handler) handler();
}
#endif
Expand Down

0 comments on commit 1f6f130

Please sign in to comment.