Resubmit: fix major memleak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ugh, seems like I left stuff in it, even though I had checked it
(old file ??).
----

Hi all,

this fixes a memleak in find_child_from_point().
It wasn't freeing the child window list in a lot of return cases.

This should resolve bug #590.
And I should be happy :-)

AbiWord, which was mentioned by the bug reporter in a mail,
doesn't eat mem on the toolbars any more...

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Determining best CVS host...
Using CVSROOT :pserver:cvs@rhlx01.fht-esslingen.de:/home/wine
Index: windows/winpos.c
===================================================================
RCS file: /home/wine/wine/windows/winpos.c,v
retrieving revision 1.132
diff -u -r1.132 winpos.c
--- windows/winpos.c	6 Apr 2002 00:40:41 -0000	1.132
+++ windows/winpos.c	27 May 2002 20:48:25 -0000
@@ -327,6 +327,7 @@
     RECT rectWindow, rectClient;
     WND *wndPtr;
     HWND *list = WIN_ListChildren( parent );
+    HWND retvalue = 0;
 
     if (!list) return 0;
     for (i = 0; list[i]; i++)
@@ -362,12 +363,14 @@
         if (style & WS_MINIMIZE)
         {
             *hittest = HTCAPTION;
-            return list[i];
+            retvalue = list[i];
+	    goto end;
         }
         if (style & WS_DISABLED)
         {
             *hittest = HTERROR;
-            return list[i];
+            retvalue = list[i];
+	    goto end;
         }
 
         /* If point is in client area, explore children */
@@ -379,23 +382,30 @@
             new_pt.x = pt.x - rectClient.left;
             new_pt.y = pt.y - rectClient.top;
             if ((ret = find_child_from_point( list[i], new_pt, hittest, lparam )))
-                return ret;
+	    {
+                 retvalue = ret;
+		 goto end;
+	    }
         }
 
         /* Now it's inside window, send WM_NCCHITTEST (if same thread) */
         if (!WIN_IsCurrentThread( list[i] ))
         {
             *hittest = HTCLIENT;
-            return list[i];
+            retvalue = list[i];
+	    goto end;
         }
         if ((res = SendMessageA( list[i], WM_NCHITTEST, 0, lparam )) != HTTRANSPARENT)
         {
             *hittest = res;  /* Found the window */
-            return list[i];
+            retvalue = list[i];
+	    goto end;
         }
         /* continue search with next sibling */
     }
-    return 0;
+end:
+    if (list) HeapFree( GetProcessHeap(), 0, list );
+    return retvalue;
 }
 
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux