Re: [ROOT] How to determine the cause of a BadGC error?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Jun 03 2003 - 11:41:59 MEST


Hi Glen,

  I've fixed the bug yesterday evening. Please get the latest cvs
version.

-- Fons


On Tue, 2003-06-03 at 05:22, Glen R. Salo wrote:
> Fons,
> 
> No, I do not use gVirtualX->CreateGC().  The problem seems to occur when
> I delete the pointer to the TGListTree (*ListTree) as indicated below in
> the few lines of code I extracted from the example I sent in previously.
> If I don't delete this pointer in the destructor, the code seems to work
> okay; but I believe that this causes a memory leak which will eventually
> cause the code to crash.
> 
> Is my usage of TGListTree correct?  This problem only seems to occur
> when I create a transient window that contains a TGCanvas and a
> TGListTree.  However, it is quite possible that I have a coding error
> somewhere else that is causing this problem.  We you able to confirm
> that my example resulted in a BadGC error message (and sometimes
> crashes)?
> 
> Thanks for the help,
> 
> Glen
> 
>   TGListTree *ListTree = new TGListTree(ListTreeCanvas->GetViewPort(),
>                                         10, 10, kHorizontalFrame, 
>                                         TGFrame::GetWhitePixel());
>   fWidgets.Add(ListTree); // Works if this line is commented 
>                          //  fWidgets.Delete() is called in the dtor
>  
>   ListTreeCanvas->SetContainer(ListTree);
>   ListTree->SetCanvas(ListTreeCanvas);
>   ListTree->AddItem(ListTree->GetFirstItem(),"Item");
> 
> 
> 
> On 02 Jun 2003 17:20:53 +0200
> Fons Rademakers <Fons.Rademakers@cern.ch> wrote:
> 
> > Hi Glen,
> > 
> >   do you create your own GC's via gVirtualX->CreateGC() ?
> > 
> > Cheers, Fons.
> > 
> > 
> > 
> > On Mon, 2003-06-02 at 00:49, Glen R. Salo wrote:
> > > Bertrand,
> > > 
> > > Thanks for the suggestion.  However, I am still unable to find my
> > > problem.  Attached is a sample code that illustrates the problem I
> > > believe I am having with my real code.  To compile the code, do:
> > > 
> > > g++ -g -o nodetest TNodeListTest.cxx `root-config --glibs`
> > > `root-config --cflags`
> > > 
> > > Execute nodetest (./nodetest) click on "Click Here", then on
> > > "Close", then on "Click Here" again.  When I do this, I get the
> > > following error:
> > > 
> > > 
> > > Error in <RootX11ErrorHandler>: BadGC (invalid GC parameter) (XID:
> > > 0, XREQ: 56) Error in <RootX11ErrorHandler>: BadGC (invalid GC
> > > parameter) (XID: 0, XREQ: 56)
> > > 
> > > Any help solving this problem is greatly appreciated.
> > > 
> > > Thanks,
> > > 
> > > Glen
> > > 
> > > On Sun, 1 Jun 2003 14:35:48 +0200
> > > "Bertrand Bellenot" <bellbert@scopus.ch> wrote:
> > > 
> > > > Hello friends,
> > > > 
> > > > In order to solve the problem, please remove these lines into
> > > > TGListTree destructor :
> > > > 
> > > >    gVirtualX->DeleteGC(fDrawGC);
> > > >    gVirtualX->DeleteGC(fLineGC);
> > > >    gVirtualX->DeleteGC(fHighlightGC);
> > > > 
> > > > Cheers,
> > > > Bertrand.
> > > > 
> > > > ----- Original Message -----
> > > > From: "Glen R. Salo" <glenrsalo@earthlink.net>
> > > > To: <roottalk@pcroot.cern.ch>
> > > > Sent: Sunday, June 01, 2003 12:41 AM
> > > > Subject: [ROOT] How to determine the cause of a BadGC error?
> > > > 
> > > > 
> > > > > After updating my version of ROOT to the CVS version on May 31,
> > > > > 2003, a program that use to run without problems crashes with
> > > > > the following error:
> > > > >
> > > > > Error in <RootX11ErrorHandler>: BadGC (invalid GC parameter)
> > > > > (XID: 143767944, XREQ: 56)
> > > > >
> > > > > The problem seems to be with one of my classes that uses a
> > > > > TGListTree, but I am having a hard time trying to pin-point the
> > > > > cause as the problem seems to occur after the destructor has
> > > > > completed and before the next line in the calling routine.  Any
> > > > > suggestions?
> > > > >
> > > > > I am running RedHat 9.0 with the latest updates on an P4
> > > > > platform.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Glen
> > > > >
> > > > >
> > > > >
> > -- 
> > Org:    CERN, European Laboratory for Particle Physics.
> > Mail:   1211 Geneve 23, Switzerland
> > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET