Handling of Ctrl-C in a stand-alone GUI (Unix)

Hi,

I’m a bit confused about what exactly happens if I interrupt a stand-alone GUI from a terminal by pressing Ctrl-C.

Will all memory used by the GUI be deallocated or do I have to make sure of that myself?

The application is set up like that:

[code]MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h){
fMain = new TGMainFrame(p, w, h);
fMain->SetCleanup(kDeepCleanup);
fMain->Connect(“CloseWindow()”, “MyMainFrame”, fMain, “CloseWindow()”);
// …
}

MyMainFrame::~MyMainFrame(){ fMain->Cleanup(); }

void MyMainFrame::CloseWindow(){ gApplication->Terminate(); }

void myGui(){ new MyMainFrame(gClient->GetRoot(), 100, 100); }

int main(int argc, char **argv) {
TApplication theApp(“App”,&argc,argv);
myGui();
theApp.Run();
return 0;
}[/code]

Hi,

It depends what you do in your application (and how you build your GUI), but anyway, if the application exits when pressing Ctrl+C, the memory should be freed (you can also try to verify with valgrind)

Cheers, Bertrand.