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;
gROOT->Print();
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.