Error in <RootX11ErrorHandler>: BadDrawable...BadWindow

Error in : BadDrawable…BadWindow…

The following errors are generated when the code runs and it malfunctions…

  1. Error in : BadDrawable (invalid Pixmap or Window parameter) (TGCompositeFrame XID: 56623414, XREQ: 62)
  2. Error in : BadWindow (invalid Window parameter) (TGCompositeFrame XID: 56623414, XREQ: 2)

This is a standalone executable using root.
I have generated a smaller sample code which duplicates the errors generated.
The executable has to be generated using the following commands:
1.make clean 2. make dict 3. make
and to run it $./nscope
first press start , after some time stop button,
then close the histogram window and then press start --malfunctions occur and error messages are generated
if initially we press start then stop then start then stop – no errors are generated.

I am using : SetCleanup(kDeepCleanup);
and Cleanup();
but I am doing something wrong which I am not able to understand.

root ver 5.34/10
linux centos 32 bit 6.4

Kindly help.Thanks and Regards, Abraham
nscope.tar.gz (16.5 KB)

Hi,

First, you should decide if your class inherit from TGMainFrame or has a TGMainFrame as member. Having both can only lead to confusion and potentially weird behaviour… :wink:
Then, try to comment out gStyle->SetOptStat(0); in HistWin::load_datamodule, or move it outside the thread.

Cheers, Bertrand.

Thanks for your guidance Bertrand.
I proceeded on two paths :
case a: inherited from TGMainFrame -> nscopeI
case b: not inherited from TGMainFrame , but TGMainFrame as a member function ->nscopeNI

In case a : I got the source to compile and get executable :smiley:
in this case - when the histogram window is closed and reopened by pressing
‘Show MCA Spectrum’ then the following warning comes ON SCREEN
Warning in TROOT::Append: Replacing existing TH1: MCA (Potential memory leak).
Shall I just ignore this warning ? :question:
or do I have to do something so that it is not generated ? :question:
should I have : TH1I *fHpx_waveMCA; as a global variable ? :question:

In case b : got error :frowning:
‘fClient’ was not declared in this scope
replaced by gClient and proceeded but then it gives error on the lines where
Associate(this); — is there.
How to proceed from here ? which pointer to give as argument to Associate( ? );

Thanks for your help. =D> Regards,
Cheers, ABRAHAM
nscopeNI.tar.gz (16.5 KB)
nscopeI.tar.gz (16.5 KB)

Hi Abraham,

[quote=“Abyroot2014”]Thanks for your guidance Bertrand.[/quote]You’re welcome :slight_smile:

[quote=“Abyroot2014”]Warning in TROOT::Append: Replacing existing TH1: MCA (Potential memory leak).
Shall I just ignore this warning ?
or do I have to do something so that it is not generated ?
should I have : TH1I *fHpx_waveMCA; as a global variable ? [/quote]No, you already have way too many global variables… To prevent this warning, you can simply delete the fHpx_waveMCA histogram (e.g. in the HistWin destructor)

if (fHpx_waveMCA) delete fHpx_waveMCA;This is something you should do anyway

[quote=“Abyroot2014”]In case b : got error
‘fClient’ was not declared in this scope
replaced by gClient and proceeded but then it gives error on the lines where
Associate(this); — is there.
How to proceed from here ? which pointer to give as argument to Associate( ? );[/quote]Well, I would go for the case a (which is the most logical choice anyway) and forget about the case b.

Cheers, Bertrand.

Error in : fatal X11 error (connection to server lost?!)

**** Save data and exit application ****

I am getting the above error when I close the main window by pressing ‘x’ instead of pressing the
‘Close’ button. :^o #-o
I have put 'Dontcallclose() in the constructor but it does not seem to work. :^o #-o
I am attaching the code.
Thanks for your help.
Best regards, Abraham
nscopeI.tar.gz (16.2 KB)

One more query : is it ok to use
DeleteWindow ();
to close the child window , there is also the: DestroyWindow();
which of these would be proper to use.
Thanks in advance.
Best Regards

Hi Abraham,

Frankly speaking, I don’t know how how your code can possibly work… But anyway, for the main frame, you must call CloseWindow(), and in your class destructor, you should not call CloseWindow(), you should not have your own Main::CloseWindow(), I would advise to not use those constructors:

public: Main(); Main(const TGWindow * p); But this one instead:public: Main(const TGWindow *p, UInt_t w, UInt_t h);
Or, if you want to keep the two constructors, at least properly call the TGMainFrame constructor:

Ad in this method: void Main::MakePanel(const TGWindow * q) // (TGCompositeFrame * TabPanel)You pass gClient->GetRoot() as argument, and then you add frame to it (instead of the main frame), and so on… So you should definitively review your code…

Cheers, Bertrand.