Spelt / ZXing.Delphi

ZXing Barcode Scanning object Pascal Library for Delphi VCL and Delphi Firemonkey
Apache License 2.0
471 stars 206 forks source link

Access violation on vcl webcamera demo #96

Closed george-kar closed 4 years ago

george-kar commented 4 years ago

It looks like that when I run the vcl camera app and open camera after moving to find a qr code the moment that qr is found access violation appears. Here is log from madExcept. Any idea what cause this? I have Delphi 10.2

main thread ($42d0): 0040887a +006 Webcam.exe System 16994 +1 TObject.Free 006e6c24 +178 Webcam.exe Unit2 94 +15 TForm2.NewVideoFrameEvent 00409cd6 +05a Webcam.exe System 20669 +38 @HandleFinally 77307fb2 +0f2 ntdll.dll RtlUnwind 77314221 +021 ntdll.dll KiUserExceptionDispatcher 006ced01 +059 Webcam.exe ZXing.Datamatrix.Internal.Decoder 127 +9 TDataMatrixDecoder.decode 006dee43 +11f Webcam.exe ZXing.Datamatrix.DataMatrixReader 143 +31 TDataMatrixReader.decode 006e1645 +0f1 Webcam.exe ZXing.MultiFormatReader 329 +21 TMultiFormatReader.DecodeInternal 006e08ed +015 Webcam.exe ZXing.MultiFormatReader 137 +1 TMultiFormatReader.decode 006e5519 +081 Webcam.exe ZXing.ScanManager 158 +11 TScanManager.Scan 006e6b48 +09c Webcam.exe Unit2 89 +10 TForm2.NewVideoFrameEvent 0066064e +07e Webcam.exe VFrames 294 +10 TVideoImage.WndProc 00535ed0 +014 Webcam.exe System.Classes 17405 +8 StdWndProc 76fd3ebb +00b USER32.dll DispatchMessageW 0063af1b +0f3 Webcam.exe Vcl.Forms 10641 +23 TApplication.ProcessMessage 0063af5e +00a Webcam.exe Vcl.Forms 10671 +1 TApplication.HandleMessage 0063b291 +0c9 Webcam.exe Vcl.Forms 10809 +26 TApplication.Run 006f4d2d +051 Webcam.exe Webcam 22 +6 initialization 76136357 +017 KERNEL32.DLL BaseThreadInitThunk

main thread ($42d0), inner exception level 1:

EAccessViolation, Access violation at address 0040887C in module 'Webcam.exe'. Read of address 8000000E 0040887c +008 Webcam.exe System 16994 +1 TObject.Free 006ceeda +232 Webcam.exe ZXing.Datamatrix.Internal.Decoder 183 +65 TDataMatrixDecoder.decode 006dee43 +11f Webcam.exe ZXing.Datamatrix.DataMatrixReader 143 +31 TDataMatrixReader.decode 006e1645 +0f1 Webcam.exe ZXing.MultiFormatReader 329 +21 TMultiFormatReader.DecodeInternal 006e08ed +015 Webcam.exe ZXing.MultiFormatReader 137 +1 TMultiFormatReader.decode 006e5519 +081 Webcam.exe ZXing.ScanManager 158 +11 TScanManager.Scan 006e6b48 +09c Webcam.exe Unit2 89 +10 TForm2.NewVideoFrameEvent 0066064e +07e Webcam.exe VFrames 294 +10 TVideoImage.WndProc 00535ed0 +014 Webcam.exe System.Classes 17405 +8 StdWndProc 76fd3ebb +00b USER32.dll DispatchMessageW 0063af1b +0f3 Webcam.exe Vcl.Forms 10641 +23 TApplication.ProcessMessage 0063af5e +00a Webcam.exe Vcl.Forms 10671 +1 TApplication.HandleMessage 0063b291 +0c9 Webcam.exe Vcl.Forms 10809 +26 TApplication.Run 006f4d2d +051 Webcam.exe Webcam 22 +6 initialization 76136357 +017 KERNEL32.DLL BaseThreadInitThunk

main thread ($42d0), inner exception level 2:

EAccessViolation, Access violation at address 0040887C in module 'Webcam.exe'. Read of address C35B5E5B 0040887c +008 Webcam.exe System 16994 +1 TObject.Free 006ceeda +232 Webcam.exe ZXing.Datamatrix.Internal.Decoder 183 +65 TDataMatrixDecoder.decode 006dee43 +11f Webcam.exe ZXing.Datamatrix.DataMatrixReader 143 +31 TDataMatrixReader.decode 006e1645 +0f1 Webcam.exe ZXing.MultiFormatReader 329 +21 TMultiFormatReader.DecodeInternal 006e08ed +015 Webcam.exe ZXing.MultiFormatReader 137 +1 TMultiFormatReader.decode 006e5519 +081 Webcam.exe ZXing.ScanManager 158 +11 TScanManager.Scan 006e6b48 +09c Webcam.exe Unit2 89 +10 TForm2.NewVideoFrameEvent 0066064e +07e Webcam.exe VFrames 294 +10 TVideoImage.WndProc 00535ed0 +014 Webcam.exe System.Classes 17405 +8 StdWndProc 76fd3ebb +00b USER32.dll DispatchMessageW 0063af1b +0f3 Webcam.exe Vcl.Forms 10641 +23 TApplication.ProcessMessage 0063af5e +00a Webcam.exe Vcl.Forms 10671 +1 TApplication.HandleMessage 0063b291 +0c9 Webcam.exe Vcl.Forms 10809 +26 TApplication.Run 006f4d2d +051 Webcam.exe Webcam 22 +6 initialization 76136357 +017 KERNEL32.DLL BaseThreadInitThunk

george-kar commented 4 years ago

Also, when the app shutdowns it detects memory leaks

13 - 20 bytes: TBitMatrixParser x 1, TSampleGrabberCBImpl x 1 29 - 36 bytes: EAccessViolation x 2, TSampleGrabberCB x 1 85 - 92 bytes: TVideoSample x 1 173 - 188 bytes: UnicodeString x 2 The sizes of unexpected leaked medium and large blocks are: 4908, 983020, 983020, 983020

JohnTApp commented 4 years ago

Hi George, I just stumbled across your issue here as I have one open as well. I'm far, far from an expert, but I originally had similar issues with the demos provided. Have a look at this link to see if it provides you a way to work around what I suspect is a threading issue . https://stackoverflow.com/questions/60472540/delphi-zxing-always-errors-in-windows-using-webcam Cheers.