Laex / Delphi-OpenCV

Project Delphi-OpenCV. Translation of OpenCV library header files in Delphi
507 stars 226 forks source link

Memory Leak: TocvCaptureSource #43

Closed tiger822 closed 8 years ago

tiger822 commented 8 years ago

1/put a TocvCameraSource on tdatamodule, set enabled equal 'False', put the statement 'ocvmrsrc1.enabled:=true;' in Tdatamodule.onCreate event.

2/ report memory leak: ReportMemoryLeaksOnShutdown:=true;

when close program, unexpected memory leak: tocvcapturethread.execute $1$Actrec X1, TCriticalSection X1, TocvCaptureThread X1

check opencv source, found the bug in ocv.comp.source.pas, TocvCustomSource.TerminateSourceThread, it should be wait the thread terminated. just like this if FourceThread.Supended then begin FourceThread.resume; sleep(10); end; while FourceThread.FLiveFlag<>0 do begin sleep(10); Application.processMessages; end; FSourceThread:=nil;


but the property 'enabled' use default value 'True', all is OK.