Crash with a TGTextEntry

Hello Rooters

I have a crash with a TGTextEntry
if a modify the text inside TGTextEntry

I gave a example in ziped files

compilation lines :
rootcint -f mainDict.cxx -c GVSetPage.h mainLinkDef.h
and
g++ root-config --cflags --glibs -o main mainDict.cxx main.c GVSetPage.cxx

run “main” file

In window box if you modify page name and click OK i have a crash!!
Have you a idea??

Thank a lot for your help!!

Luc
files.zip (3.03 KB)

Hi Luc,

Your code works for me on Windows. I’ll check tomorrow on Linux and let you know.
BTW, which version of ROOT, which OS, which compiler?

Cheers,
Bertrand.

Hi Luc,

in GVSetPage::CloseWindow(), replace delete (this); by: DeleteWindow();
Cheers,
Bertrand.

Really Thanks You!!!

But what is the difference between
delete (this);
and
DeleteWindow();

and why it works on windows?

Luc

You’re welcome!
DeleteWindow() tells X11 to properly delete the window. “delete this” deletes the class, and X11 may still try to access it (or to send message to it), hence the crash (BadWindow error).
And Windows is completely different (there is no client-server approach like on X11)
Cheers,
Bertrand.

Thanks for your explanations!

Luc