[Uml-devel] The need for deleteContents to delete objects in objectList (in umldoc.cpp)

Brian Thomas brian.thomas at gsfc.nasa.gov
Mon Nov 24 08:17:02 UTC 2003

	Oliver, all,

	I think that there is a _definite_ need to be cleaning up the objects that arent needed by
	the umldoc anymore, and the correct spot is  in umldoc deleteContents(). If this functionality
	is ignored I can easily imagine large memory leaks are created as there is no way to enforce
	the deletion of these objects (objectList is set to autoDelete(false) on purpose). What is the 
	solution then?

	An excerpt of commented out code in UMLDoc:

                       // clear our object list. We do this explicitly since setAutoDelete is false for the objectList now.
                        /* Sorry Brian, but this crashes (see bug 68701.)
                        for(UMLObject * obj = objectList.first(); obj != 0; obj = objectList.next())
                                delete obj;

	What objects was this crashing on exactly? (e.g. associations? classes? interfaces?). It sounds
	to me like the object was not properly 'unhooked' from the other objects when it was deleted.
	-Or- perhaps you can't use objectList in a for loop that is deleting its contents (?) If so, what code 
	would avoid that?

	Any ideas out there?


More information about the umbrello-devel mailing list