This topic is now archived and is closed to further replies.


How to force a particular destructor?

Recommended Posts

	Window* ctrl=this->controls;
	Window* temp;
		temp = ctrl->next;
		delete ctrl;
		ctrl = temp;
Window is an abstract class and has no destructor of it''s own. I have a RoundTree control that is inherited from an abstract class TreeView (again, no destructor) which is inherited from Window. So, RoundTree is a Window which I am able to add to Form->controls. Problem is, when I delete a form, the Form destructor gets called but the line "delete ctrl;" never calls the RoundTree destructor and I get huge memory leaks. How can I force it to be called?

Share this post

Link to post
Share on other sites