Hi! I'm trying to use a TGListView Widget in a configuration dialog for my GUI. Everything works fine until I close the TGTransientFrame and try to reopen it. Then something crashes, concerning the deleted TGListView because removing just the TGListView::AddItem() calls from the dialogs constructor "solves" the problem. I extracted the important code from my program (to make it more readable) and attached it to my mail. This is how to crash my program: I am running rootcint on my sources: rootcint -f tglvtestDict.cpp -c tglvtest.h tglvtestLinkDef.h Then compiling the sources, starting the program, pushing the button, closing the newly appeared window and again pushing the button. The result is this: *** Break *** segmentation violation .... *** Break *** segmentation violation Segmentation fault A gdb backtrace gives following Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 11690)] 0x4107bd38 in pthread_mutex_lock () from /lib/libpthread.so.0 (gdb) backtrace #0 0x4107bd38 in pthread_mutex_lock () from /lib/libpthread.so.0 #1 0x4107e752 in flockfile () from /lib/libpthread.so.0 #2 0x4118e982 in getc () from /lib/libc.so.6 #3 0x412bd78d in xpmNextString () from /usr/X11R6/lib/libXpm.so.4 #4 0x412c0981 in ParseAndPutPixels () from /usr/X11R6/lib/libXpm.so.4 #5 0x412c064d in xpmParseDataAndCreate () from /usr/X11R6/lib/libXpm.so.4 #6 0x412c519d in XpmReadFileToImage () from /usr/X11R6/lib/libXpm.so.4 #7 0x412c613b in XpmReadFileToPixmap () from /usr/X11R6/lib/libXpm.so.4 #8 0x4126e9f1 in TGX11::CreatePictureFromFile () from /usr/local/lib/root/libGX11.so #9 0x40e44add in TGPicturePool::GetPicture () from /usr/local/lib/root/libGui.so #10 0x40e161b6 in TGClient::GetPicture () from /usr/local/lib/root/libGui.so #11 0x40e474b3 in TGHScrollBar::TGHScrollBar () from /usr/local/lib/root/libGui.so #12 0x40e13fd8 in TGCanvas::TGCanvas () from /usr/local/lib/root/libGui.so #13 0x40e359e5 in TGListView::TGListView () from /usr/local/lib/root/libGui.so #14 0x0804ae31 in Popup::Popup (this=0x8603290, p=0x85ca0b8, main=0x85da070) at tglvtest.C:14 #15 0x0804b900 in MainFrame::DoButton (this=0x85da040) at tglvtest.C:79 #16 0x0804c8a0 in G__MainFrame_DoButton_2_2 (result7=0x85ecab4, funcname=0x0, libp=0x85ecad0, hash=0) at tglvtestDict.cpp:236 #17 0x406069c3 in G__CallFunc::Exec () from /usr/local/lib/root/libCint.so #18 0x4015fc68 in TQConnection::ExecuteMethod () from /usr/local/lib/root/libCore.so #19 0x4016270f in TQObject::Emit () from /usr/local/lib/root/libCore.so #20 0x40f6c6d9 in TGButton::Clicked () from /usr/local/lib/root/libGui.so #21 0x40e0fe43 in TGButton::SetState () from /usr/local/lib/root/libGui.so #22 0x40e0ff31 in TGButton::HandleButton () from /usr/local/lib/root/libGui.so #23 0x40e226b4 in TGFrame::HandleEvent () from /usr/local/lib/root/libGui.so #24 0x40e16f90 in TGClient::HandleEvent () from /usr/local/lib/root/libGui.so #25 0x40e16c3a in TGClient::ProcessOneEvent () from /usr/local/lib/root/libGui.so #26 0x40e16cdd in TGClient::HandleInput () from /usr/local/lib/root/libGui.so #27 0x40e14e62 in TGInputHandler::Notify () from /usr/local/lib/root/libGui.so #28 0x401cf580 in TUnixSystem::DispatchOneEvent () from /usr/local/lib/root/libCore.so #29 0x4017711e in TSystem::InnerLoop () from /usr/local/lib/root/libCore.so #30 0x40177089 in TSystem::Run () from /usr/local/lib/root/libCore.so #31 0x40137d13 in TApplication::Run () from /usr/local/lib/root/libCore.so #32 0x0804ba30 in main (argc=1, argv=0xbffff8b4) at tglvtest.C:103 #33 0x4113f7ee in __libc_start_main () from /lib/libc.so.6 I am getting no hints out of these, so if anybody encountered a similar problem or knows how to solve it, please let me know. By the way, is it possible to add a TGLVEntry without pictures? If yes how, just passing NULL to the constructor did not do the trick. Thanks for any help on this, Sascha [------------- START tglvtest.h ------------------------------------------] #ifndef __tglvtest__ #define __tglvtest__ #include <TROOT.h> #include <TApplication.h> #include <TGFrame.h> #include <TGButton.h> #include <TGPicture.h> #include <TList.h> #include <TGString.h> #include <TGListView.h> #include <RQ_OBJECT.h> class MainFrame { RQ_OBJECT("MainFrame"); public: MainFrame(); virtual ~MainFrame(); void DoButton(); private: TGMainFrame *pMainFr; TGButton *pBt; TGLayoutHints *pL; }; class Popup { RQ_OBJECT("Popup"); public: Popup(const TGWindow* p, const TGWindow *main); virtual ~Popup(); void CloseWindow(); private: TGMainFrame *pMainFr; TGCompositeFrame *pMainCont; TGListView *pLV; TGLVContainer *pLVCont; TGLVEntry *pEntry; TGString **pEntryStr; TGPicturePool *pPicPool; const TGPicture *pPic; TGLayoutHints *pL; }; #endif // __tglvtest__ [------------ END tglvtest.h ---------------------------------------------] [------------ START tglvtest.C -----------------------------------------------] #include "tglvtest.h" Popup::Popup(const TGWindow* p, const TGWindow *main) { pMainFr = new TGTransientFrame(p, main, 300, 200); pMainFr->Connect("CloseWindow()", "Popup", this, "CloseWindow()"); pMainCont = new TGCompositeFrame(pMainFr, 300, 200, kVerticalFrame); pLV = new TGListView(pMainCont, 200, 100); pLVCont = new TGLVContainer(pLV->GetViewPort(), 200, 100, kHorizontalFrame, TGFrame::GetWhitePixel()); pLVCont->SetListView(pLV); pLV->SetContainer(pLVCont); pLV->SetHeaders(2); pLV->SetHeader("Name", kTextLeft, kTextLeft, 0); pLV->SetHeader("Description", kTextLeft, kTextLeft, 1); pLV->SetViewMode(kLVDetails); pPicPool = new TGPicturePool(gClient, "/usr/X11R6/share/icons/xpm/locolor/16x16/actions"); pPic = pPicPool->GetPicture("gear.xpm"); pEntryStr = new (TGString*)[2]; pEntryStr[0] = new TGString("Description"); pEntryStr[1] = 0; pEntry = new TGLVEntry(pLVCont, pPic, pPic, new TGString("Entry"), pEntryStr, kLVDetails); pLVCont->AddItem(pEntry); pMainCont->AddFrame(pLV, pL = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY)); pMainFr->AddFrame(pMainCont, pL); pMainFr->MapSubwindows(); pMainFr->Resize(pMainFr->GetDefaultSize()); pMainFr->MapWindow(); gClient->WaitFor(pMainFr); } Popup::~Popup() { delete pL; delete pEntry; pPicPool->FreePicture(pPic); delete pPicPool; delete pLVCont; delete pLV; delete pMainCont; delete pMainFr; } void Popup::CloseWindow() { delete this; } MainFrame::MainFrame() { pMainFr = new TGMainFrame(gClient->GetRoot(), 300, 200); pBt = new TGTextButton(pMainFr, "Popup"); pBt->Connect("Clicked()", "MainFrame", this, "DoButton()"); pMainFr->AddFrame(pBt, pL = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)); pMainFr->MapSubwindows(); pMainFr->MapWindow(); } MainFrame::~MainFrame() { delete pL; delete pBt; delete pMainFr; } void MainFrame::DoButton() { new Popup(gClient->GetRoot(), pMainFr); } void tglvtest() { new MainFrame(); } //----- standalone program ------------------ #ifdef STANDALONE TROOT root("TGCanvas", "TGCanvas testing"); int main(int argc, char **argv) { TApplication theApp("App", &argc, argv); if (gROOT->IsBatch()) { fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]); return 1; } tglvtest(); theApp.Run(); return 0; } #endif [------------- END tglvtest.C ----------------------------------------------] [------------ START tglvtestLinkDef.h ---------------------------------------] #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class Popup; #pragma link C++ class MainFrame; #endif [---------------- END tglvtestLinkDef.h --------------------------------------] -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:50 MET