jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

EXC_BAD_ACCESS KERN_INVALID_ADDRESS #386

Closed fysteven closed 6 years ago

fysteven commented 8 years ago

Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000011348088

Crashed: com.apple.main-thread 0 libobjc.A.dylib 0x181565b90 objc_msgSend + 16 1 Branch 0x10013226c -MBProgressHUD done 2 UIKit 0x187087c28 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312 3 UIKit 0x187087ab0 -[UIViewAnimationState animationDidStop:finished:] + 108 4 QuartzCore 0x1849e19a0 CA::Layer::run_animation_callbacks(void*) + 284 5 libdispatch.dylib 0x18193947c _dispatch_client_callout + 16 6 libdispatch.dylib 0x18193eb84 _dispatch_main_queue_callback_4CF + 1844 7 CoreFoundation 0x181ea4d50 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 8 CoreFoundation 0x181ea2bb8 __CFRunLoopRun + 1628 9 CoreFoundation 0x181dccc50 CFRunLoopRunSpecific + 384 10 GraphicsServices 0x1836b4088 GSEventRunModal + 180 11 UIKit 0x1870b6088 UIApplicationMain + 204 12 Branch 0x1000c42dc main (main.m:14) 13 libdispatch.dylib 0x18196a8b8 (Missing)

matej commented 8 years ago

How can this bee reproduced? Which version of MBProgressHUD are you using?

fysteven commented 8 years ago

I'm using the latest version. I've been pretty busy these days. I haven't got a chance to see how to replicate the bug. However, most users who got this crash seem to be iOS 9.3.x users.

fysteven commented 8 years ago

It turns out that in some cases where the view controller containing the HUD is deallocated but the delegate of the HUD still points to the released controller, which causes the problem.

matej commented 8 years ago

The delegate is weak so it should get converted into nil if the object it points to deallocates.

huuang commented 8 years ago

I am using version 0.92, have similar crash. The delegate is MB_WEAK, it is weak or not depends on the deployment target. I am using cocoapods version 1.0.1, and my app is ARC, but can not change MB_WEAK delegate to weak delegate, there is an error:Cannot synthesize weak property because the current deployment target does not support weak references

matej commented 6 years ago

I'm going to close this one. The delegate is now always weak. If there is an issue here, it's likely in client code.

If anybody has good reproduction steps then please reopen.