Hi, When I try to use TGTextButton with TGHButtonGroup in compiled code with ROOT version 3.03.06, and gcc 3.0.1 (ROOT was also compiled with the same compiler), I get a segmentation violation error. The crash seems to happen when the TGTextButton is added to the TGHButtonGroup, though I have not completely followed this through. The very same code works with ROOT version 3.01.06. Attached is a small example that reproduces the problem, with three files: crash.h, crash.cxx, and Makefile. Compile by typing "make," assuming gmake and that g++ is version 3.0.1. Thanks in advance for finding the problem. I am on a x86 Linux box. Regards, Gora #include <Rtypes.h> #include <TROOT.h> #include <TApplication.h> #include <TGButton.h> #include <TGButtonGroup.h> #include <TGClient.h> #include <TGFrame.h> #include <TGLayout.h> extern void InitGui(); VoidFuncPtr_t initfuncs[] = { InitGui, 0 }; TROOT root( "Rapp", "The ROOT Application Interface", initfuncs ); class MyMainFrame : public TGMainFrame { private: TGHButtonGroup *fbtn_grp; TGTextButton *fbtn; TGLayoutHints *fbtn_lyt, *fbtn_grp_lyt; public: MyMainFrame(const TGWindow*); virtual ~MyMainFrame(); }; #include <cstdlib> #include "crash.h" MyMainFrame::MyMainFrame(const TGWindow* main) : TGMainFrame( main, 800, 400 ) { fbtn_grp = new TGHButtonGroup( this, "Button group" ); fbtn = new TGTextButton( fbtn_grp, "Button" ); fbtn->Associate( this ); fbtn_lyt = new TGLayoutHints( kLHintsLeft | kLHintsBottom, 2, 2, 0, 0 ); fbtn_grp->SetLayoutHints( fbtn_lyt ); fbtn_grp->Show(); fbtn_grp_lyt = new TGLayoutHints( kLHintsCenterX | kLHintsTop, 0, 0, 0, 0 ); AddFrame( fbtn_grp, fbtn_grp_lyt ); SetWindowName( "ROOT application" ); MapSubwindows(); Layout(); // We need to use GetDefaultSize() to initialize the layout algorithm Resize( GetDefaultSize() ); MapWindow(); } MyMainFrame::~MyMainFrame() { delete fbtn_lyt; delete fbtn; delete fbtn_grp_lyt; delete fbtn_grp; } int main(int argc, char *argv[]) { TApplication app( "ROOT application", &argc, argv ); MyMainFrame main = new MyMainFrame( gClient->GetRoot() ); app.Run(); exit( EXIT_SUCCESS ); } CXX = g++ CXXOPTS = -O2 CXXFLAGS = -ansi -pedantic -Wall -W -Wwrite-strings -Wmissing-prototypes -Woverloaded-virtual -Wsign-promo -Wno-long-long -Wno-unused CXXINCS = SOFLAGS = -shared CXXLIBS = -lm -ldl -rdynamic SYSXLIBS = -L/usr/X11R6/lib -lXpm -lX11 CINTSYSDIR = $(ROOTSYS)/cint ROOTLIBS := $(shell root-config --libs) ROOTGLIBS := $(shell root-config --glibs) ROOTINCS = -I$(ROOTSYS)/include CINTINCS = $(CXXINCS) $(ROOTINCS) INCLUDES = $(CXXINCS) $(ROOTINCS) LIBS = $(CXXLIBS) $(ROOTLIBS) GLIBS = $(ROOTGLIBS) $(SYSXLIBS) all: crash.cxx crash.h @echo -e \\nGenerating object file $(CXX) $(CXXOPTS) $(CXXFLAGS) $(INCLUDES) -o crash crash.cxx $(LIBS) $(GLIBS)
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET