Hi everyone,
I have this architecture: MyFrame (inherits from wxFrame) which has a child MySplitter (inherits from wxSplitterWindow) which itself has a child LeftWindow (inherits from wxWindow).
For some reasons i would like to be sure that, when i close the app, the LeftWindow is destroyed before the MyFrame.
According to this sentence in the doc: "Please note that all children of the window will be deleted automatically by the destructor before the window itself is deleted which means that you don't have to worry about deleting them manually", i shouldn't have to do anything as the child are destroyed first.
But, when i put a log in the MyFrame's destructor and in the LeftWindow's one I can see that the MyFrame's destructor is called first.
I guess i miss understood something but i don't really see what.
Thanks for your help.
wxWindow Destruction order. Topic is solved
Re: wxWindow Destruction order.
First the wxFrame dtor is called. Then its wxWindow base dtor will be called. And that one will destroy all its children.
Use the source, Luke!
Re: wxWindow Destruction order.
Oh ok thanks.
Is there a way to add something in the wxWindow base destructor of the Frame ? Because i want to clean some elements when i destroy the frame but i need to be sure that the children are deleted first.
Is there a way to add something in the wxWindow base destructor of the Frame ? Because i want to clean some elements when i destroy the frame but i need to be sure that the children are deleted first.
Re: wxWindow Destruction order.
I found something.
I put what i wanted to destroy in the MyApp destructor instead of inside the MyFrame destroctor and it works perfectly.
I put what i wanted to destroy in the MyApp destructor instead of inside the MyFrame destroctor and it works perfectly.