对象在已经解除分配时过度释放;打破objc_overrelease_during_dealloc_error进行调试

时间:2015-10-05 09:48:41

标签: ios objective-c iphone cocoa automatic-ref-counting

我在IBOutlet子类中使用强PDFView来自定义NSViewController但是在切换视图控制器后我在10.11崩溃了。在10.8,10.9和10.10上一切正常。我正在使用ARC。

self.activeRootViewController = controller;
self.backgroundWindow.contentView = controller.view;

@property (strong) IBOutlet MYPDFView* pdfView; // property inside NSViewController subclass.
  

MYPDFView对象0x10ac1bc50在已经解除分配时被过度释放;   在objc_overrelease_during_dealloc_error上打破调试

我在objc_overrelease_during_dealloc_error添加了断点但无法解决此问题。

有人可以帮帮我吗?

dealloc方法MYPDFView只被调用一次。

来自lldb的回溯:

objc[23395]: MYPDFView object 0x10ac1bc50 overreleased while already deallocating; break on objc_overrelease_during_dealloc_error to debug
Process 23395 stopped
* thread #1: tid = 0x11b04b, 0x00007fff926bcb1c libobjc.A.dylib`objc_overrelease_during_dealloc_error, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 2.1
    frame #0: 0x00007fff926bcb1c libobjc.A.dylib`objc_overrelease_during_dealloc_error
libobjc.A.dylib`objc_overrelease_during_dealloc_error:
->  0x7fff926bcb1c <+0>: retq   
    0x7fff926bcb1d <+1>: nop    

libobjc.A.dylib`objc_object::sidetable_lock:
    0x7fff926bcb1e <+0>: movl   %edi, %eax
    0x7fff926bcb20 <+2>: shrl   $0x9, %eax
(lldb) bt
* thread #1: tid = 0x11b04b, 0x00007fff926bcb1c libobjc.A.dylib`objc_overrelease_during_dealloc_error, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 2.1
  * frame #0: 0x00007fff926bcb1c libobjc.A.dylib`objc_overrelease_during_dealloc_error
    frame #1: 0x00007fff926bd78a libobjc.A.dylib`objc_object::overrelease_error() + 42
    frame #2: 0x00007fff9ad13102 AppKit`-[NSImmediateActionGestureRecognizer dealloc] + 42
    frame #3: 0x00007fff9702ce3c CoreFoundation`-[__NSArrayM removeAllObjects] + 252
    frame #4: 0x00007fff9a426caf AppKit`-[NSView removeAllGestureRecognizers] + 294
    frame #5: 0x00007fff9a4257b3 AppKit`-[NSView _finalizeWithReferenceCounting] + 1333
    frame #6: 0x00007fff9a425256 AppKit`-[NSView dealloc] + 151
    frame #7: 0x00007fff906ef366 PDFKit`-[PDFView dealloc] + 834
    frame #8: 0x000000010003236d MYApp`-[MYPDFView dealloc] + 125
    frame #9: 0x00007fff926a6094 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 476
    frame #10: 0x00007fff96fc7a72 CoreFoundation`_CFAutoreleasePoolPop + 50
    frame #11: 0x00007fff9c7f30fe Foundation`__NSFireDelayedPerform + 441
    frame #12: 0x00007fff970119f4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame #13: 0x00007fff97011683 CoreFoundation`__CFRunLoopDoTimer + 1075
    frame #14: 0x00007fff970111da CoreFoundation`__CFRunLoopDoTimers + 298
    frame #15: 0x00007fff970086d1 CoreFoundation`__CFRunLoopRun + 1841
    frame #16: 0x00007fff97007d38 CoreFoundation`CFRunLoopRunSpecific + 296
    frame #17: 0x00007fff9517dd55 HIToolbox`RunCurrentEventLoopInMode + 235
    frame #18: 0x00007fff9517da97 HIToolbox`ReceiveNextEventCommon + 184
    frame #19: 0x00007fff9517d9cf HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
    frame #20: 0x00007fff9a433f3a AppKit`_DPSNextEvent + 1067
    frame #21: 0x00007fff9a433369 AppKit`-[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
    frame #22: 0x00007fff9a427ecc AppKit`-[NSApplication run] + 682
    frame #23: 0x00007fff9a3f1162 AppKit`NSApplicationMain + 1176
    frame #24: 0x0000000100003452 MYApp`main + 34
    frame #25: 0x00007fff8eecc5ad libdyld.dylib`start + 1
    frame #26: 0x00007fff8eecc5ad libdyld.dylib`start + 1
(lldb) 

0 个答案:

没有答案