EdwardvanRaak / MaterialBarcodeScanner

Easy to use barcode reader for your Android Project (Uses Google Mobile Vision API)
Apache License 2.0
272 stars 113 forks source link

Crash due to multiple instances #21

Open TheDorkKnightRises opened 8 years ago

TheDorkKnightRises commented 8 years ago

In my app I have a circular reveal animation when I press FAB, and I'm calling startScan() in onAnimationStart(). Maybe due to the slight delay caused by animation, it is possible to tap the FAB very quickly to open multiple instances of MaterialBarcodeScanner. After which, I can exit the topmost instance. But when I exit the next instance, there is a NullPointerException when trying to free Vision Detector (as it has already been freed?)

FATAL EXCEPTION: main Process: thedorkknightrises.techraceapp, PID: 31958 java.lang.RuntimeException: Unable to destroy activity {thedorkknightrises.techraceapp/com.edwardvanraak.materialbarcodescanner.MaterialBarcodeScannerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.vision.Detector.release()' on a null object reference

TheDorkKnightRises commented 8 years ago

Looked at the stack trace and wrote an easy fix. Please merge.

lucazin commented 5 years ago

this is fixed ?

lucazin commented 5 years ago

FATAL EXCEPTION: main Process: thedorkknightrises.techraceapp, PID: 31958 java.lang.RuntimeException: Unable to destroy activity {thedorkknightrises.techraceapp/com.edwardvanraak.materialbarcodescanner.MaterialBarcodeScannerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.vision.Detector.release()'

i have this problem ..how can i fix this my friend ? i have the latest version 0.0.6 alpha