changeset 290:8ea5b2c35bfe

Fixed tree memory leak on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 23 Mar 2003 15:35:03 +0000
parents 0e6f09149eaa
children 70480069392b
files os2/dw.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Wed Mar 19 14:58:23 2003 +0000
+++ b/os2/dw.c	Sun Mar 23 15:35:03 2003 +0000
@@ -317,6 +317,8 @@
 			if(data)
 				free(data);
 		}
+		else if(strncmp(tmpbuf, "#37", 4)==0)
+			dw_container_clear(handle, FALSE);
 
 		if(wd->oldproc)
 			WinSubclassWindow(handle, wd->oldproc);
@@ -5734,7 +5736,7 @@
  */
 void API dw_tree_clear(HWND handle)
 {
-	WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE));
+	dw_container_clear(handle, TRUE);
 }
 
 /*
@@ -6256,6 +6258,21 @@
 {
 	int z = 0;
 
+	if(!dw_window_get_data(handle, "_dw_container"))
+	{
+		PCNRITEM pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
+
+		while(pCore)
+		{
+			/* Free icon text */
+			if(pCore->rc.pszIcon)
+			{
+				free(pCore->rc.pszIcon);
+				pCore->rc.pszIcon = 0;
+			}
+			pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
+		}
+	}
 	while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1)
 	{
 		z++;