# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1048433703 0 # Node ID 8ea5b2c35bfef891dbd4470678a269d962e0d0a5 # Parent 0e6f09149eaa5cd94fd2694484cfc6a6bb67a400 Fixed tree memory leak on OS/2. diff -r 0e6f09149eaa -r 8ea5b2c35bfe os2/dw.c --- 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++;