comparison os2/dw.c @ 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 d81bebc5c8cc
comparison
equal deleted inserted replaced
1766:47e503ecc812 1767:31edce4598d0
506 free(data); 506 free(data);
507 } 507 }
508 else if(strncmp(tmpbuf, "#37", 4)==0) 508 else if(strncmp(tmpbuf, "#37", 4)==0)
509 { 509 {
510 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); 510 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
511 PFIELDINFO first;
511 512
512 dw_container_clear(handle, FALSE); 513 dw_container_clear(handle, FALSE);
513 if(wd && dw_window_get_data(handle, "_dw_container")) 514 if(wd && dw_window_get_data(handle, "_dw_container"))
514 { 515 {
515 void *oldflags = wd->data; 516 void *oldflags = wd->data;
516 wd->data = NULL; 517 wd->data = NULL;
517 free(oldflags); 518 free(oldflags);
519 }
520 /* Free memory allocated for the container column titles */
521 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
522 {
523 if(first->pTitleData)
524 free(first->pTitleData);
525 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
518 } 526 }
519 if(coltitle) 527 if(coltitle)
520 free(coltitle); 528 free(coltitle);
521 } 529 }
522 530
9229 if(z==separator-1) 9237 if(z==separator-1)
9230 left=details; 9238 left=details;
9231 details->cb = sizeof(FIELDINFO); 9239 details->cb = sizeof(FIELDINFO);
9232 details->flData = flags[z]; 9240 details->flData = flags[z];
9233 details->flTitle = CFA_FITITLEREADONLY; 9241 details->flTitle = CFA_FITITLEREADONLY;
9234 details->pTitleData = titles[z]; 9242 details->pTitleData = strdup(titles[z]);
9235 details->offStruct = offStruct[z]; 9243 details->offStruct = offStruct[z];
9236 details = details->pNextFieldInfo; 9244 details = details->pNextFieldInfo;
9237 } 9245 }
9238 9246
9239 detin.cb = sizeof(FIELDINFOINSERT); 9247 detin.cb = sizeof(FIELDINFOINSERT);