View Issue Details

IDProjectCategoryView StatusLast Update
0015342LazarusPatchpublic2010-04-22 11:14
ReporterAnton Kavalenka Assigned ToPaul Ishenin  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformAllOSWindows 2003 Server 
Product Version0.9.29 (SVN) 
Fixed in Version0.9.29 (SVN) 
Summary0015342: DockManager: fix semantic coding errors leading to memory and GDI resource leakage
DescriptionI understand the code is very raw, but it is bad practice - non-freeing bitmaps and canvases.
TagsNo tags attached.
Fixed in Revision23144
LazTarget-
WidgetsetGTK 2, Win32/Win64
Attached Files

Activities

2009-12-14 18:39

 

dockmanager.patch (1,324 bytes)   
Index: package/easydocksite.pas
===================================================================
--- package/easydocksite.pas	(revision 23138)
+++ package/easydocksite.pas	(working copy)
@@ -979,10 +979,14 @@
   if FTopZone.FirstChild = nil then
     exit; //no zones - nothing to paint
   ACanvas := TCanvas.Create;
-  ACanvas.Handle := DC;
-  GetCursorPos(MousePos);
-  MousePos := DockSite.ScreenToClient(MousePos);
-  PaintZone(FTopZone);
+  try
+    ACanvas.Handle := DC;
+    GetCursorPos(MousePos);
+    MousePos := DockSite.ScreenToClient(MousePos);
+    PaintZone(FTopZone);
+  finally
+    Acanvas.Free;
+  end;
 end;
 
 procedure TEasyTree.RemoveControl(Control: TControl);
Index: package/zoneheader.inc
===================================================================
--- package/zoneheader.inc	(revision 23138)
+++ package/zoneheader.inc	(working copy)
@@ -27,13 +27,12 @@
 end;
 
 procedure DestroyDockHeaderImages;
-//var ImageKind: TDockHeaderImageKind;
+var ImageKind: TDockHeaderImageKind;
 begin
 //called from unit finalization only!
-{ this code can result in crashes, due to missing handles
+// this code can result in crashes, due to missing handles
   for ImageKind := Low(TDockHeaderImageKind) to High(TDockHeaderImageKind) do
     FreeAndNil(DockBtnImages[ImageKind]);
-}
 end;
 
 
dockmanager.patch (1,324 bytes)   

Paul Ishenin

2009-12-15 04:57

manager   ~0033098

Thanks, applied. Please close if ok.

Anton Kavalenka

2010-04-15 21:32

reporter   ~0036734

Bitmap destruction disapeared again.

It seems to me author (dodi) tries to compensate another bug with non-freing images.

Please ask dodi to report the bug separately.

Paul Ishenin

2010-04-16 03:56

manager   ~0036740

I will write him a mail.

Issue History

Date Modified Username Field Change
2009-12-14 18:39 Anton Kavalenka New Issue
2009-12-14 18:39 Anton Kavalenka File Added: dockmanager.patch
2009-12-14 18:39 Anton Kavalenka Widgetset => GTK 2, Win32/Win64
2009-12-15 04:57 Paul Ishenin Fixed in Revision => 23144
2009-12-15 04:57 Paul Ishenin LazTarget => -
2009-12-15 04:57 Paul Ishenin Status new => resolved
2009-12-15 04:57 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-12-15 04:57 Paul Ishenin Resolution open => fixed
2009-12-15 04:57 Paul Ishenin Assigned To => Paul Ishenin
2009-12-15 04:57 Paul Ishenin Note Added: 0033098
2009-12-15 14:36 Anton Kavalenka Status resolved => closed
2010-04-15 21:32 Anton Kavalenka Status closed => assigned
2010-04-15 21:32 Anton Kavalenka Resolution fixed => reopened
2010-04-15 21:32 Anton Kavalenka Note Added: 0036734
2010-04-16 03:56 Paul Ishenin Status assigned => resolved
2010-04-16 03:56 Paul Ishenin Resolution reopened => fixed
2010-04-16 03:56 Paul Ishenin Note Added: 0036740
2010-04-22 11:14 Anton Kavalenka Status resolved => closed