Hello,
I have a gui that I built on the guitest.C tutorial and then extended/modified. I decided to try and be responsible and do some memory management and make sure everything is being deleted properly. I will just reference the guitest.C tutorial since my code is built on it. As far as I can tell, the destructor for TestMainFrame is never called. All the other classes (TestDiaglog, TestSliders, etc.) have a CloseWindow() method which calls ‘delete this’ for the class and therefore calls their respective destructors. The MainFrame, under TestMainFrame, only calls gApplication->Terminate() under its CloseWindow() method.
I added in a print statement to the TestMainFrame::~TestMainFrame and saw that it is not called. So unless gApplication->Terminate() is doing some other cleanup, it seems that things are being left allocated and causing memory leaks. Should the CloseWindow be changed?:
From
TestMainFrame::CloseWindow(){
gApplication->Terminate();
}
To
TestMainFrame::CloseWindow(){
delete this;
gApplication->Terminate();
}
Where now the destructor will be called. Also, is there supposed to be a behavior difference between
delete fMain;
and
fMain->DeleteWindow();
Thank you,
_ROOT Version: 6.16.0
_Platform: Mac OSX 10.14.6
Compiler: Not Provided