ROOT crash when using text entry in TGCanvas


I experience a fatal ROOT crash (i.e. so bad that I have to close the terminal) whenever I close a GUI window containing an entry field (TGTextEntry or TGNumberEntry) in a TGCanvas AND I entered text into the fields (there is no crash if I do not enter text).

Here is the basic code:

TGLayoutHints* Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 20, 20, 10, 0);
TGCanvas* Viewer = new TGCanvas(this, 100, 100);
TGCompositeFrame* Container = new TGCompositeFrame(Viewer->GetViewPort(), 50, 50);
AddFrame(Viewer, Layout);

TGTextEntry* E = new TGTextEntry(Container);
Container->AddFrame(E, Layout);

Is this the correct usage for a TGCanvas?
Is there an alternative when I want to have a large set of text entries through which a dynamically created and the user can scroll through to avoid this problem?

The error message is:

root [1] .x Problem.C
root [2] Error in : BadWindow (invalid Window parameter) (TGTextEntry XID: 102760708, XREQ: 61)
TGTextEntry: 102760708
TGCompositeFrame: 102760707

*** Break *** segmentation violation

#10 0x01fc30af in TGWindow::Print(char const*) const () from /prg/root_v5.27.04/lib/
#11 0x01efbda7 in TGFrame::Print(char const*) const () from /prg/root_v5.27.04/lib/
#12 0x08b565a8 in RootX11ErrorHandler(_XDisplay*, XErrorEvent*) () from /prg/root_v5.27.04/lib/
#13 0x067cd299 in _XError () from /usr/lib/
#14 0x067d392f in ?? () from /usr/lib/
#15 0x067d4356 in _XEventsQueued () from /usr/lib/
#16 0x067bca68 in XPending () from /usr/lib/
#17 0x08b55799 in TGX11::EventsPending() () from /prg/root_v5.27.04/lib/
#18 0x01eb8a38 in TGClient::ProcessOneEvent() () from /prg/root_v5.27.04/lib/
#19 0x01eb8b2d in TGClient::HandleInput() () from /prg/root_v5.27.04/lib/
#20 0x01eb8b60 in TGInputHandler::Notify() () from /prg/root_v5.27.04/lib/
#21 0x009c33fd in TUnixSystem::DispatchOneEvent(bool) () from /prg/root_v5.27.04/lib/
#22 0x009359e1 in TSystem::InnerLoop() () from /prg/root_v5.27.04/lib/
#23 0x009388d9 in TSystem::Run() () from /prg/root_v5.27.04/lib/
#24 0x008cf8c7 in TApplication::Run(bool) () from /prg/root_v5.27.04/lib/
#25 0x0011f261 in TRint::Run(bool) () from /prg/root_v5.27.04/lib/
#26 0x08048ecf in main ()

I am using root 5.27.04 ob Ubuntu 10.4 but I also get the same error on 5.24.00b on CentOS.

Thanks for any help,
Problem.C (1.38 KB)

Hi Andreas,

Adding: Viewer->GetViewPort()->SetCleanup(kDeepCleanup);should solve the problem.

Cheers, Bertrand.

Hello Bertrand,

Thanks a lot. This fix worked!