Dear Rooters
I have the weird problem that my application crashes sporadically after
it has terminated successfully.
This is my main function:
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;
}
XPSFrame *xpsApp = new XPSFrame(0, 400, 220);
theApp.Run(kTRUE); //kTRUE needed in order to delete xpsApp!
delete xpsApp;
cout << "XPSApp successfully terminated." << endl;
return 0;
}//main
Usually, it exits normally, but sometimes I get:
XPSApp successfully terminated.
*** Break *** segmentation violation
[1]+ Abort trap ./XPSApp
This means that it crashes after termination!
Below I add the output of the crash reporter of MacOS X.
It shows that the crash occurs at TGPicturePool::FreePicture()
Since my application uses TShutter, there are two methods calling a picture:
1, CreateShutter() contains:
fDefaultPic = gClient->GetPicture("folder_s.xpm");
which I delete in DeleteShutter()
2, AddShutterItem() contains the following code fragment:
for (Int_t i=0; data[i].sPixmapName != 0; i++) {
buttonpic = gClient->GetPicture(data[i].sPixmapName);
if (!buttonpic) {
printf("Shutter: missing pixmap \"%s\", using default",
data[i].sPixmapName);
buttonpic = fDefaultPic;
}//if
button = new TGPictureButton(container, buttonpic, data[i].sId);
fTrash->Add(button);
button->Connect("Clicked()", "XPSFrame", this, "DoShutter()");
button->SetToolTipText(data[i].sTipText);
data[i].sButton = button;
container->AddFrame(button, hint);
}//for_i
I am not sure if there is an error in this code. Remember, that in most
cases my application terminates without any problem.
Does anybody have a hint?
Best regards
Christian
Here is the output of the CrashReporter:
Host: m1398p012.adsl.highway.telekom.at
Date/Time: 2005-05-23 22:41:09 +0200
OS Version: 10.3.1 (Build 7C107)
Command: XPSApp (./XPSApp)
PID: 663
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xd3000000
Thread 0 Crashed:
#0 0xd3000000 in 0xd3000000
#1 0x04ea22e0 in TGPicturePool::FreePicture(TGPicture const*) (TGPicturePool::FreePicture(TGPicture const*) + 48)
#2 0x04e83894 in TGListTreeItem::~TGListTreeItem unified (TGListTreeItem::~TGListTreeItem unified + 60)
#3 0x04e85be8 in TGListTree::PDeleteChildren(TGListTreeItem*) (TGListTree::PDeleteChildren(TGListTreeItem*) + 120)
#4 0x04e85bb8 in TGListTree::PDeleteChildren(TGListTreeItem*) (TGListTree::PDeleteChildren(TGListTreeItem*) + 72)
#5 0x04e85bb8 in TGListTree::PDeleteChildren(TGListTreeItem*) (TGListTree::PDeleteChildren(TGListTreeItem*) + 72)
#6 0x04e83c70 in TGListTree::~TGListTree unified (TGListTree::~TGListTree unified + 116)
#7 0x02c520c8 in TList::Delete(char const*) (TList::Delete(char const*) + 152)
#8 0x02c4fc34 in THashList::Delete(char const*) (THashList::Delete(char const*) + 32)
#9 0x04e530b0 in TGClient::~TGClient unified (TGClient::~TGClient unified + 96)
#10 0x04eca408 in TRootApplication::~TRootApplication unified (TRootApplication::~TRootApplication unified + 92)
#11 0x02bcc4d4 in TApplication::~TApplication unified (TApplication::~TApplication unified + 168)
#12 0x0008fa94 in main (main + 328)
#13 0x00002254 in _start (crt.c:267)
#14 0x000020c8 in start (start + 48)
PPC Thread State:
srr0: 0xd3000000 srr1: 0x4000d930 vrsave: 0x00000000
cr: 0x44004242 xer: 0x00000004 lr: 0x02c507c0 ctr: 0xd3000000
r0: 0x02c507a4 r1: 0xbffff820 r2: 0x055a991b r3: 0x04a21740
r4: 0x030cb69c r5: 0x04a21740 r6: 0x031a5680 r7: 0x00000001
r8: 0x0000001f r9: 0xa00011ac r10: 0x00001897 r11: 0x05602004
r12: 0xd3000000 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000
r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19: 0x00000000
r20: 0x00000000 r21: 0x00000000 r22: 0x00000000 r23: 0x00000000
r24: 0x00000000 r25: 0x00000000 r26: 0xbffffd98 r27: 0x00000000
r28: 0x04871ee0 r29: 0x04853fc0 r30: 0x04a21740 r31: 0x02c5077c