Crash at _CFAutoreleasePoolPop

2019-09-02 14:05发布

问题:

I got a crash from Fabric,the stack is below:

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                6806634868 objc_release + 20
1  libsystem_blocks.dylib         6813456656 _Block_release + 256
2  libobjc.A.dylib                6806640420 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
3  CoreFoundation                 6529519172 _CFAutoreleasePoolPop + 28
4  UIKit                          6605817924 _wrapRunLoopWithAutoreleasePoolHandler + 76
5  CoreFoundation                 6530394704 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
6  CoreFoundation                 6530382300 __CFRunLoopDoObservers + 360
7  CoreFoundation                 6530383292 __CFRunLoopRun + 836
8  CoreFoundation                 6529519780 CFRunLoopRunSpecific + 396
9  GraphicsServices               6682260900 GSEventRunModal + 168
10 UIKit                          6606283712 UIApplicationMain + 1488
11 Spec                           4297532060 main (main.m:15)
12 libdyld.dylib                  6813280776 start + 4

I don't know why it would be _Block_release after (anonymous namespace)::AutoreleasePoolPage::pop(void*). Is it possible that a block was added to autoreleasepool?if possible, why the block crashed at release and it not crashed at invoke?

回答1:

Ok,I had resolve this bug.The reason for the crash was that I had hook the function objectAtIndex for NSMutableArray.And If user switch from background,the app would get a crash -[UIKeyboardLayoutStar release]: message sent to deallocated.

So remove the hook code will resolve this bug.