hansemannn / titanium-coreml

Use the CoreML framework with the Titanium SDK
Other
15 stars 4 forks source link

Crash on takePicture being called #2

Open joe-f opened 6 years ago

joe-f commented 6 years ago

Getting the following crash on takePicture method being called, crashes 7 out of 10 times.

I think _currentSampleBuffer is sometimes already released before takePicture gets a chance to copy it.

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000eb06dbeb8 VM Region Info: 0xeb06dbeb8 is not in any region. Bytes after previous region: 55036460729

hansemannn commented 6 years ago

It uses ARC, so memory in general should be fine. But I could think of cases where we would need tl use weak / strong block-validation of "self here and assign _currentSampleBuffer to a strong self. Same goes for the [self processRecognitionWithSampleBuffer:sampleBuffer] call, which should use a strong-self as well as dispatched on the main-thread to ensure it properly returns back from the background-thread used to compute the image. Give it a try!