OrigamiEngine icon indicating copy to clipboard operation
OrigamiEngine copied to clipboard

Dealloc crash while using KVO

Open obrhoff opened this issue 9 years ago • 8 comments

Sometimes Origiami Crashes because an KVO hasn't been unsubscribed while dealloc.

'NSInternalInconsistencyException', reason: 'An instance 0x7b875c40 of class ORGMInputUnit was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x78f1c020> (
<NSKeyValueObservance 0x78f1bfe0: Observer: 0x78f67c90, Key path: endOfInput, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x78ff3de0>
)'
*** First throw call stack:
(
    0   CoreFoundation                      0x01dd1466 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x04f5ca97 objc_exception_throw + 44
    2   CoreFoundation                      0x01dd138d +[NSException raise:format:] + 141
    3   Foundation                          0x04b88dd4 NSKVODeallocate + 379
    4   libobjc.A.dylib                     0x04f71772 _ZN11objc_object17sidetable_releaseEb + 248
    5   libobjc.A.dylib                     0x04f70e9b objc_release + 43
    6   libobjc.A.dylib                     0x04f59bd8 objc_setProperty_nonatomic + 48
    7   vinylify                            0x00293552 -[ORGMConverter setInputUnit:] + 66
    8   vinylify                            0x00292657 -[ORGMConverter dealloc] + 151
    9   libobjc.A.dylib                     0x04f71772 _ZN11objc_object17sidetable_releaseEb + 248
    10  libobjc.A.dylib                     0x04f70e9b objc_release + 43
    11  libobjc.A.dylib                     0x04f59bd8 objc_setProperty_nonatomic + 48
    12  vinylify                            0x00297092 -[ORGMOutputUnit setConverter:] + 66
    13  vinylify                            0x0029649e -[ORGMOutputUnit stop] + 78
    14  vinylify                            0x002961d7 -[ORGMOutputUnit dealloc] + 55
    15  libobjc.A.dylib                     0x04f71772 _ZN11objc_object17sidetable_releaseEb + 248
    16  libobjc.A.dylib                     0x04f70e9b objc_release + 43
    17  libobjc.A.dylib                     0x04f59bd8 objc_setProperty_nonatomic + 48
    18  vinylify                            0x00295232 -[ORGMEngine setOutput:] + 66
    19  vinylify                            0x00293de6 __42-[ORGMEngine playUrl:withOutputUnitClass:]_block_invoke + 950
    20  libdispatch.dylib                   0x05a825ea _dispatch_call_block_and_release + 15
    21  libdispatch.dylib                   0x05aa4bef _dispatch_client_callout + 14
    22  libdispatch.dylib                   0x05a88d61 _dispatch_queue_drain + 544
    23  libdispatch.dylib                   0x05a889cb _dispatch_queue_invoke + 212
    24  libdispatch.dylib                   0x05a8c012 _dispatch_root_queue_drain + 615
    25  libdispatch.dylib                   0x05a8db70 _dispatch_worker_thread3 + 115
    26  libsystem_pthread.dylib             0x05e001da _pthread_wqthread + 724
    27  libsystem_pthread.dylib             0x05dfde2e start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException```

obrhoff avatar Apr 06 '15 10:04 obrhoff

+1 same here

rperney avatar Apr 07 '15 14:04 rperney

+1

daria-kopaliani avatar Apr 16 '15 06:04 daria-kopaliani

I will try to look into it over the weekend.

ap4y avatar Apr 20 '15 03:04 ap4y

+1

diogobalseiro avatar Jul 15 '15 11:07 diogobalseiro

This commit may have fixed this: b504080a03a33c42a25917a8babb986ccce4c52c

diogobalseiro avatar Jul 15 '15 15:07 diogobalseiro

Tried add [_input removeObserver:self forKeyPath:@"endOfInput"]; after [self removeObserver:self forKeyPath:@"currentState"]; in ORGMEngine.m and works

freemanlam avatar Nov 09 '16 00:11 freemanlam

+1

TiSsaa avatar Apr 05 '17 11:04 TiSsaa

Resolved by adding: [self.output release]; In class ORGMEngine at function - (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass:

ORGMOutputUnit *output = [[outputUnitClass alloc] initWithConverter:_converter]; output.outputFormat = _outputFormat; [self.output release]; self.output = output; [output release];

TiSsaa avatar Apr 09 '17 13:04 TiSsaa