#include using namespace std; #include #include #include #include #include #include #include #include class MainFrame : public TGMainFrame { private: public: MainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MainFrame(); void Create(); ClassDef(MainFrame, 0) }; MainFrame::MainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h) { // Create main frame Create(); SetCleanup(kDeepCleanup); } MainFrame::~MainFrame() { // Clean up main frame... } void MainFrame::Create() { TGLayoutHints* Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 20, 20, 10, 0); TGLabel* Label = new TGLabel(this, "If one closes this window without entering text, then\n" "everything is fine. However, entering text and closing\n" "the window afterwards leads to a fatal ROOT crash!"); AddFrame(Label, Layout); TGCanvas* Viewer = new TGCanvas(this, 100, 100); TGCompositeFrame* Container = new TGCompositeFrame(Viewer->GetViewPort(), 50, 50); Viewer->SetContainer(Container); AddFrame(Viewer, Layout); TGTextEntry* E = new TGTextEntry(Container); Container->AddFrame(E, Layout); MapSubwindows(); MapWindow(); Layout(); } void Problem() { new MainFrame(gClient->GetRoot(), 400, 200); }