Mercurial > dwindows
changeset 1767:31edce4598d0
On OS/2 make a duplicate of the column titles when setting up containers...
In DWIB now that it no longer leaks XML memory, the memory for the
column titles in the XML tree gets freed and the OS/2 columns then show
corrupted memory. So duplicate the titles and free them when destroyed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Jul 2012 08:16:44 +0000 |
parents | 47e503ecc812 |
children | 227e13044ce3 |
files | os2/dw.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/os2/dw.c Sun Jul 01 07:51:25 2012 +0000 +++ b/os2/dw.c Sun Jul 01 08:16:44 2012 +0000 @@ -508,6 +508,7 @@ else if(strncmp(tmpbuf, "#37", 4)==0) { char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); + PFIELDINFO first; dw_container_clear(handle, FALSE); if(wd && dw_window_get_data(handle, "_dw_container")) @@ -516,6 +517,13 @@ wd->data = NULL; free(oldflags); } + /* Free memory allocated for the container column titles */ + while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) + { + if(first->pTitleData) + free(first->pTitleData); + WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); + } if(coltitle) free(coltitle); } @@ -9231,7 +9239,7 @@ details->cb = sizeof(FIELDINFO); details->flData = flags[z]; details->flTitle = CFA_FITITLEREADONLY; - details->pTitleData = titles[z]; + details->pTitleData = strdup(titles[z]); details->offStruct = offStruct[z]; details = details->pNextFieldInfo; }