Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dispatch_get_current_queue crash (Issue #108) #121

Merged
merged 2 commits into from
Nov 1, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ - (id)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 @@ - (id)initWithLogMsg:(NSString *)msg
#pragma clang diagnostic pop

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

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