Skip to content

Commit

Permalink
Merge pull request #121 from denivip/108-current-queue-crash
Browse files Browse the repository at this point in the history
Fix dispatch_get_current_queue crash (Issue #108)
  • Loading branch information
bpoplauschi committed Nov 1, 2013
2 parents ebee454 + af6c85a commit e997ea8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Lumberjack/DDLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,14 @@ - (instancetype)initWithLogMsg:(NSString *)msg
timestamp = [[NSDate alloc] init];

machThreadID = pthread_mach_thread_np(pthread_self());


#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
// dispatch_get_current_queue() is deprecated and most importantly it
// crashes sometimes and there's no other way to reliably get the name
// of the current queue.

queueLabel = dd_str_copy("");
#else
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// The documentation for dispatch_get_current_queue() states:
Expand All @@ -874,6 +881,7 @@ - (instancetype)initWithLogMsg:(NSString *)msg
#pragma clang diagnostic pop

queueLabel = dd_str_copy(dispatch_queue_get_label(currentQueue));
#endif

threadName = [[NSThread currentThread] name];
}
Expand Down

0 comments on commit e997ea8

Please sign in to comment.