[GME-commit] GMESRC/GME/Gme GUIObject.cpp, 1.57, 1.58 GUIObject.h, 1.25, 1.26

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Tue Mar 18 14:23:59 CDT 2008


Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv17288

Modified Files:
	GUIObject.cpp GUIObject.h 
Log Message:
Memory leak, GuiPort objects appended into collection continuously when aspect changed.
GetNeighBorsInOut method for finding neighbors who are in-connected and out-connected.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: GUIObject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** GUIObject.h	17 Oct 2006 23:04:22 -0000	1.25
--- GUIObject.h	18 Mar 2008 19:23:57 -0000	1.26
***************
*** 218,221 ****
--- 218,222 ----
  	int	MapAspect(int parent)							{ return guiAspects[parent] ? guiAspects[parent]->GetIndex() : -1; }
  	void GetNeighbors(CGuiFcoList &list);
+ 	void GetNeighborsInOut(CGuiFcoList &list, bool inOrOut);
  	CGuiPortList &GetPorts()							{ VERIFY(GetCurrentAspect()); return GetCurrentAspect()->GetPortList(); }
  	CGuiAspect *GetCurrentAspect()						{ return guiAspects[parentAspect]; }

Index: GUIObject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** GUIObject.cpp	20 Nov 2006 19:48:15 -0000	1.57
--- GUIObject.cpp	18 Mar 2008 19:23:57 -0000	1.58
***************
*** 1151,1156 ****
  	}
  
! 	delete lpsz;
! 	delete tok;;
  
  	if (progId.IsEmpty()) {
--- 1151,1156 ----
  	}
  
! 	delete [] lpsz; // WAS: delete lpsz;
! 	delete [] tok;; // WAS: delete tok;;
  
  	if (progId.IsEmpty()) {
***************
*** 1293,1296 ****
--- 1293,1326 ----
  }
  
+ void CGuiObject::GetNeighborsInOut(CGuiFcoList &list, bool p_inOrOut)
+ {
+ 	VERIFY(GetCurrentAspect());
+ 	
+ 	// acquire ports
+ 	POSITION ppos = GetCurrentAspect()->GetPortList().GetHeadPosition();
+ 	while (ppos) 
+ 	{
+ 		// one port
+ 		CGuiPort *port = GetCurrentAspect()->GetPortList().GetNext(ppos);
+ 
+ 		ASSERT( port); 
+ 		if( !port) continue;
+ 
+ 		// acquire the in/out connections through the current port
+ 		POSITION cpos = p_inOrOut? port->GetInConns().GetHeadPosition(): port->GetOutConns().GetHeadPosition();
+ 		while(cpos) 
+ 		{
+ 			// one connection
+ 			CGuiConnection *conn = p_inOrOut? port->GetInConns().GetNext(cpos): port->GetOutConns().GetNext(cpos);
+ 
+ 			ASSERT( conn);
+ 			if( !conn) continue;
+ 
+ 			// store its src/dst
+ 			if( p_inOrOut? conn->src: conn->dst)
+ 				list.AddTail( p_inOrOut? conn->src: conn->dst);
+ 		}
+ 	}
+ }
  
  void CGuiObject::ReadAllLocations()
***************
*** 2263,2268 ****
  
  			if (visible[parentAspect]) {
! 				srcPort->outConns.AddTail(this);
! 				dstPort->inConns.AddTail(this);
  			}
  
--- 2293,2301 ----
  
  			if (visible[parentAspect]) {
! 				if( !srcPort->outConns.Find( this)) // WAS: outConns.AddTail(this); and as a result as aspects have cycled the collection got bigger and bigger
! 					srcPort->outConns.AddTail(this);// NOW: added only if ptr was not already stored in outConns
! 				
! 				if( !dstPort->inConns.Find( this)) // WAS: inConns.AddTail(this);
! 					dstPort->inConns.AddTail(this);// NOW: added only if ptr was not already stored in inConns
  			}
  



More information about the GME-commit mailing list