Mercurial > dwindows
diff os2/dw.c @ 1884:71780cf68aa2
More container and tree changes on all platforms regarding memory.
This should fix GTK3 memory leaks I wasn't previously aware of...
but it will cause all platforms to leak memory if strings returned
from dw_container_query_start(), dw_container_query_next() and
dw_tree_get_title() are not freed with dw_free() when using version 3.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 28 Aug 2013 23:47:40 +0000 |
parents | 6949c73e30fd |
children | f7d408a47752 |
line wrap: on
line diff
--- a/os2/dw.c Thu Aug 15 18:51:56 2013 +0000 +++ b/os2/dw.c Wed Aug 28 23:47:40 2013 +0000 @@ -9182,8 +9182,8 @@ PCNRITEM pci = (PCNRITEM)item; handle = handle; /* keep compiler happy */ - if(pci) - return (char *)pci->rc.pszIcon; + if(pci && pci->rc.pszIcon) + return strdup((char *)pci->rc.pszIcon); return NULL; } @@ -10288,7 +10288,9 @@ if(pCore->flRecordAttr & flags) { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return flags & DW_CR_RETDATA ? (char *)pCore->pszText : (char *)pCore->pszIcon; + if(flags & DW_CR_RETDATA) + return (char *)pCore->pszText; + return pCore->pszIcon ? strdup((char *)pCore->pszIcon) : NULL; } pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); } @@ -10296,7 +10298,9 @@ else { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return flags & DW_CR_RETDATA ? (char *)pCore->pszText : (char *)pCore->pszIcon; + if(flags & DW_CR_RETDATA) + return (char *)pCore->pszText; + return pCore->pszIcon ? strdup((char *)pCore->pszIcon) : NULL; } } return NULL; @@ -10325,7 +10329,9 @@ if(pCore->flRecordAttr & flags) { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return flags & DW_CR_RETDATA ? (char *)pCore->pszText : (char *)pCore->pszIcon; + if(flags & DW_CR_RETDATA) + return (char *)pCore->pszText; + return pCore->pszIcon ? strdup((char *)pCore->pszIcon) : NULL; } pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); @@ -10334,7 +10340,9 @@ else { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return flags & DW_CR_RETDATA ? (char *)pCore->pszText : (char *)pCore->pszIcon; + if(flags & DW_CR_RETDATA) + return (char *)pCore->pszText; + return pCore->pszIcon ? strdup((char *)pCore->pszIcon) : NULL; } } return NULL;