View Issue Details

IDProjectCategoryView StatusLast Update
0018935PatchesOtherpublic2011-10-20 20:28
Reporterjavivf Assigned ToJesus Reyes  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.31 (SVN) 
Target Version0.99.0Fixed in Version0.9.31 (SVN) 
Summary0018935: Fixes memleak lazreport
DescriptionFixes memleak TfrPictureView.LoadFromXML
TagsNo tags attached.
Fixed in Revision32999
LazTarget0.99.0
Widgetset
Attached Files

Activities

2011-03-17 12:40

 

lr_class.pas.diff (1,147 bytes)   
Index: lr_class.pas
===================================================================
--- lr_class.pas	(revision 29835)
+++ lr_class.pas	(working copy)
@@ -4265,14 +4265,12 @@
   Graphic: TGraphic;
   Ext: string;
 
-  procedure GetPictureStream;
+  procedure GetPictureStream(var AMS: TMemoryStream);
   begin
-    M := TMemoryStream.Create;
     try
-      XMLToStream(XML, Path+'Picture/', M);
+      XMLToStream(XML, Path+'Picture/', AMS);
     except
-      M.Free;
-      M := nil;
+      AMS := nil;
     end;
   end;
 
@@ -4290,7 +4288,7 @@
   if (b>pkBitmap) and (b<pkAny) then
     Graphic := PictureTypeToGraphic(b)
   else begin
-    GetPictureStream;
+    GetPictureStream(M);
     Graphic := StreamToGraphic(M);
   end;
 
@@ -4299,7 +4297,7 @@
   begin
     Graphic.Free;
     if M=nil then
-      GetPictureStream;
+      GetPictureStream(M);
     try
       try
         M.Position := 0;
@@ -4308,9 +4306,10 @@
         ShowMessage('Unknown Image Format!');
       end;
     finally
-      M.Free;
+      FreeAndNil(M);
     end;
   end;
+  FreeAndNil(M);
 end;
 
 procedure TfrPictureView.SaveToStream(Stream: TStream);
lr_class.pas.diff (1,147 bytes)   

Jesus Reyes

2011-10-20 20:28

developer   ~0053215

I modified the patch and applied.

Gracias por el reporte y perdón por la demora Javivf

Issue History

Date Modified Username Field Change
2011-03-17 12:40 javivf New Issue
2011-03-17 12:40 javivf File Added: lr_class.pas.diff
2011-03-30 21:03 Vincent Snijders LazTarget => 0.99.0
2011-03-30 21:03 Vincent Snijders Assigned To => Jesus Reyes
2011-03-30 21:03 Vincent Snijders Status new => assigned
2011-03-30 21:03 Vincent Snijders Target Version => 0.99.0
2011-10-20 20:28 Jesus Reyes Fixed in Revision => 32999
2011-10-20 20:28 Jesus Reyes Status assigned => resolved
2011-10-20 20:28 Jesus Reyes Fixed in Version => 0.9.31 (SVN)
2011-10-20 20:28 Jesus Reyes Resolution open => fixed
2011-10-20 20:28 Jesus Reyes Note Added: 0053215