[GME-commit] GMESRC/GME/ObjectInspector InPlaceManager.cpp,1.22,1.23

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri May 13 18:40:50 CDT 2005


Update of /project/gme-repository/GMESRC/GME/ObjectInspector
In directory escher:/tmp/cvs-serv29932

Modified Files:
	InPlaceManager.cpp 
Log Message:
Corrupted string inserted into ListItem in case when the user cleared the multiline field and left the field (killfocus). 
"Memory damage" message was shown by Visual Studio right after ListItem reference was released.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: InPlaceManager.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ObjectInspector/InPlaceManager.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** InPlaceManager.cpp	8 Mar 2004 21:45:27 -0000	1.22
--- InPlaceManager.cpp	13 May 2005 17:40:48 -0000	1.23
***************
*** 567,578 ****
  	ListItem.Value.stringVal.RemoveAll();
  	int nLineLength=m_MultiEditCtrl.GetWindowTextLength();
! 	for(int i=0;i<nLines;i++)
  	{
! 		strLine="";
! 		//nLineLength=m_MultiEditCtrl.LineLength(i); - does not work
! 		int nRet=m_MultiEditCtrl.GetLine(i,strLine.GetBuffer(nLineLength), nLineLength);
! 		strLine.ReleaseBuffer(nRet);
! 		strLine.TrimRight(_T("\r\n"));
! 		ListItem.Value.stringVal.Add(strLine);
  	}
  
--- 567,583 ----
  	ListItem.Value.stringVal.RemoveAll();
  	int nLineLength=m_MultiEditCtrl.GetWindowTextLength();
! 	// zolmol: avoid trimming in case when the field is cleared: nLineLength = 0 and nLines = 1 
! 	//         (corrupted strLine inserted into ListItem caused memory damage when released)
! 	if( nLineLength > 0 )
  	{
! 		for(int i=0;i<nLines;i++)
! 		{
! 			strLine="";
! 			//nLineLength=m_MultiEditCtrl.LineLength(i); - does not work
! 			int nRet=m_MultiEditCtrl.GetLine(i,strLine.GetBuffer(nLineLength), nLineLength);
! 			strLine.ReleaseBuffer(nRet);
! 			strLine.TrimRight(_T("\r\n"));
! 			ListItem.Value.stringVal.Add(strLine);
! 		}
  	}
  



More information about the GME-commit mailing list