comparison os2/dw.c @ 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 315812516608
comparison
equal deleted inserted replaced
289:0e6f09149eaa 290:8ea5b2c35bfe
315 void *data = dw_window_get_data(handle, "_dw_percent"); 315 void *data = dw_window_get_data(handle, "_dw_percent");
316 316
317 if(data) 317 if(data)
318 free(data); 318 free(data);
319 } 319 }
320 else if(strncmp(tmpbuf, "#37", 4)==0)
321 dw_container_clear(handle, FALSE);
320 322
321 if(wd->oldproc) 323 if(wd->oldproc)
322 WinSubclassWindow(handle, wd->oldproc); 324 WinSubclassWindow(handle, wd->oldproc);
323 325
324 dw_window_set_data(handle, NULL, NULL); 326 dw_window_set_data(handle, NULL, NULL);
5732 * Parameters: 5734 * Parameters:
5733 * handle: Handle to the window (widget) to be cleared. 5735 * handle: Handle to the window (widget) to be cleared.
5734 */ 5736 */
5735 void API dw_tree_clear(HWND handle) 5737 void API dw_tree_clear(HWND handle)
5736 { 5738 {
5737 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE)); 5739 dw_container_clear(handle, TRUE);
5738 } 5740 }
5739 5741
5740 /* 5742 /*
5741 * Expands a node on a tree. 5743 * Expands a node on a tree.
5742 * Parameters: 5744 * Parameters:
6254 */ 6256 */
6255 void API dw_container_clear(HWND handle, int redraw) 6257 void API dw_container_clear(HWND handle, int redraw)
6256 { 6258 {
6257 int z = 0; 6259 int z = 0;
6258 6260
6261 if(!dw_window_get_data(handle, "_dw_container"))
6262 {
6263 PCNRITEM pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
6264
6265 while(pCore)
6266 {
6267 /* Free icon text */
6268 if(pCore->rc.pszIcon)
6269 {
6270 free(pCore->rc.pszIcon);
6271 pCore->rc.pszIcon = 0;
6272 }
6273 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6274 }
6275 }
6259 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1) 6276 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1)
6260 { 6277 {
6261 z++; 6278 z++;
6262 if(z > 5000000) 6279 if(z > 5000000)
6263 break; 6280 break;