[PATCH] D18968: [tsan] Fix a crash with dispatch_source_set_cancel_handler(NULL) on OS X
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 12 08:23:42 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL266080: [tsan] Fix a crash with dispatch_source_set_cancel_handler(NULL) on OS X (authored by kuba.brecka).
Changed prior to commit:
http://reviews.llvm.org/D18968?vs=53253&id=53402#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18968
Files:
compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch_mac.cc
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch_mac.cc
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch_mac.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch_mac.cc
@@ -320,6 +320,8 @@
TSAN_INTERCEPTOR(void, dispatch_source_set_event_handler,
dispatch_source_t source, dispatch_block_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_event_handler, source, handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_event_handler)(source, nullptr);
dispatch_block_t new_handler = ^(void) {
{
SCOPED_INTERCEPTOR_RAW(dispatch_source_set_event_handler_callback);
@@ -334,6 +336,8 @@
TSAN_INTERCEPTOR(void, dispatch_source_set_event_handler_f,
dispatch_source_t source, dispatch_function_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_event_handler_f, source, handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_event_handler)(source, nullptr);
dispatch_block_t block = ^(void) {
handler(dispatch_get_context(source));
};
@@ -343,6 +347,8 @@
TSAN_INTERCEPTOR(void, dispatch_source_set_cancel_handler,
dispatch_source_t source, dispatch_block_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_cancel_handler, source, handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_cancel_handler)(source, nullptr);
dispatch_block_t new_handler = ^(void) {
{
SCOPED_INTERCEPTOR_RAW(dispatch_source_set_cancel_handler_callback);
@@ -358,6 +364,8 @@
dispatch_source_t source, dispatch_function_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_cancel_handler_f, source,
handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_cancel_handler)(source, nullptr);
dispatch_block_t block = ^(void) {
handler(dispatch_get_context(source));
};
@@ -368,6 +376,8 @@
dispatch_source_t source, dispatch_block_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_registration_handler, source,
handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_registration_handler)(source, nullptr);
dispatch_block_t new_handler = ^(void) {
{
SCOPED_INTERCEPTOR_RAW(dispatch_source_set_registration_handler_callback);
@@ -383,6 +393,8 @@
dispatch_source_t source, dispatch_function_t handler) {
SCOPED_TSAN_INTERCEPTOR(dispatch_source_set_registration_handler_f, source,
handler);
+ if (handler == nullptr)
+ return REAL(dispatch_source_set_registration_handler)(source, nullptr);
dispatch_block_t block = ^(void) {
handler(dispatch_get_context(source));
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18968.53402.patch
Type: text/x-patch
Size: 2820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/34d4f9e5/attachment.bin>
More information about the llvm-commits
mailing list