diff --git a/WTModule/Classes/EventBus/WTEventAction.m b/WTModule/Classes/EventBus/WTEventAction.m index 28a8e92..1189ed5 100644 --- a/WTModule/Classes/EventBus/WTEventAction.m +++ b/WTModule/Classes/EventBus/WTEventAction.m @@ -33,15 +33,24 @@ - (void)executeWithContext:(WTEventContext *)context [holder addObject:context.target]; } - __weak typeof(self) wself = self; - dispatch_async(self.executeQueue, ^{ - __strong typeof(wself) sself = wself; + //线程 问题 + if([NSThread isMainThread]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [sself.target performSelector:sself.selector withObject:context]; + [self.target performSelector:self.selector withObject:context]; #pragma clang diagnostic pop - }); + }else { + __weak typeof(self) wself = self; + dispatch_sync(self.executeQueue, ^{ + __strong typeof(wself) sself = wself; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [sself.target performSelector:sself.selector withObject:context]; +#pragma clang diagnostic pop + }); + } } + } @end diff --git "a/\346\243\200\346\265\213.png" "b/\346\243\200\346\265\213.png" new file mode 100644 index 0000000..e5e0ebe Binary files /dev/null and "b/\346\243\200\346\265\213.png" differ