From: <ob...@us...> - 2013-01-15 14:20:27
|
Revision: 13489 http://jvcl.svn.sourceforge.net/jvcl/?rev=13489&view=rev Author: obones Date: 2013-01-15 14:20:16 +0000 (Tue, 15 Jan 2013) Log Message: ----------- Mantis 5926: Fixed memory leaks Modified Paths: -------------- trunk/jvcl/run/JvHidControllerClass.pas Modified: trunk/jvcl/run/JvHidControllerClass.pas =================================================================== --- trunk/jvcl/run/JvHidControllerClass.pas 2013-01-15 13:56:50 UTC (rev 13488) +++ trunk/jvcl/run/JvHidControllerClass.pas 2013-01-15 14:20:16 UTC (rev 13489) @@ -779,6 +779,7 @@ // if device is plugged in create a checked in copy if IsPluggedIn then begin + Dev := nil; try Dev := TJvHidDevice.CtlCreate(FPnPInfo, FMyController); // make it a complete clone @@ -797,6 +798,7 @@ on EControllerError do begin FList.Delete(I); + Dev.Free; Dec(FNumUnpluggedDevices); end; end; @@ -1608,9 +1610,9 @@ // set to uncontrolled FMyController := nil; if IsCheckedOut then - DoUnplug // pull the plug for checked out TJvHidDevices - else - Free; // kill TJvHidDevices which are not checked out + DoUnplug; // pull the plug for checked out TJvHidDevices + + Free; // Always free, which will kill TJvHidDevices which are not checked out end; end; FList.Free; @@ -1779,7 +1781,10 @@ DoRemoval(HidDev); // delete from list if not HidDev.IsCheckedOut then + begin FList.Delete(I); + HidDev.Free; + end; Changed := True; end; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |