<RootX11ErrorHandler>: BadMatch

We have a monitoring application that saves out plots every 10 seconds. It works fine when we save the plots as pdf. It also works when we save gifs when the application is the active display in the active X desktop. However, if a different X desktop is active when the application attempts to save the plots as a GIF (or other bitmap image type), the application crashes with the following error:

Error in <RootX11ErrorHandler>: BadMatch (invalid parameter attributes) (TGCompositeFrame XID: 60817693, XREQ: 73)
TGCompositeFrame:       60817693
        TGViewPort:     60817668
        TRootEmbeddedCanvas:    60817667
        TGMainFrame:    60817665

Here’s my function which attempts to save the gif image:

void GUIHist::CopyCanvasToWeb(const char *path, bool forcePNGFormat){

	string strPath = path;
	if(forcePNGFormat) strPath += ".png";

	cout<<"GUIHist::CopyCanvasToWeb( "<< strPath <<" ) . . ."<<endl;
	TCanvas *cPtr = this->fEcanvas->GetCanvas();
	gVirtualX->Update(1);//Supposed to fix problem saving gifs according to some web posting
	cPtr->SaveAs( strPath.c_str() );

It might also be relevant to note that GUIHist is a class which inherits from TGMainFrame.

Thank you.

Very likely the ROOT version you are using is too old. It is now possible to save picture when running in batch. Which version are you using ?

just few words to add.
It’s also possible to save several pictures as animated gif (in batch mode).
I think it’s very nice feature for monitoring.

Regards. Valeriy

what does it mean ?

We’re using version


As for what does [quote]'if a different X desktop is active[/quote] mean. Well, many Unix X windows systems allow users to maintain and switch between multiple desktop which is great for multitasking. Maybe a picture will help.

yes, it’s expected behavior.
In the interactive mode SaveAs method converts pixmap on the
screen correspondent to canvas into image.
But in your case the canvas is not on the screen(!).

I would recommend to do in this case


Regards. Valeriy

I implemented a work around, save plots as eps and then made a system call to “convert”.

I previously tried the SetBatch(1) . . . SetBatch(0) but it caused a seg. fault.

for “gROOT->SetBatch” you must use ROOT CVS version