Form::~Form(){
Window* ctrl=this->controls;
Window* temp;
while(ctrl!=NULL){
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?
How to force a particular destructor?
Example:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement