The object is redefined, but already freed; break on objc_overrelease_during_dealloc_error for debugging

I use a strong IBOutlet for a custom PDFView in the NSViewController subclass, but I get a 10.11 crash after switching the view controller. Everything works fine 10,8,10,9 and 10,10. I am using ARC.

 self.activeRootViewController = controller; self.backgroundWindow.contentView = controller.view; @property (strong) IBOutlet MYPDFView* pdfView; // property inside NSViewController subclass. 

The MYPDFView 0x10ac1bc50 is overridden, but is already freed; break on objc_overrelease_during_dealloc_error for debugging

I added a breakpoint to objc_overrelease_during_dealloc_error , but could not solve this problem.

Can anyone help me out?

dealloc method MYPDFView is called only once.

Backtrace from 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) 
+5
source share

Source: https://habr.com/ru/post/1232960/


All Articles