Subject: | Segfault (under Linux) while creating and deleting MainWindows |
I have written a program which crashes with a Segmentation Fault after
less than half a minute under
perl, v5.8.8 built for i486-linux-gnu-thread-multi with tk-Version 804.
27 and
perl, v5.8.8 built for i686-linux with tk-Version 804.27.
It did not crash under perl, v5.8.4 built for MSWin32-x86-multi-thread.
and not under perl, v5.8.8 under WinXP.
The Program simply opens and closes rapidly a second MainWindow.
use Tk;
my $m = new MainWindow;
my $k = undef;
$m->repeat(
20 => sub {
if ($k) {
$k->destroy;
$k = undef;
}
else {
$k = new MainWindow;
}
}
);
A friend of mine made a backtrace:
(gdb) backtrace
#0 0xb7d8793e in Tk_GetOptionValue (interp=0x84b669c,
recordPtr=0x84bf4e8
"\220\200K\bh\020\026\b\234fK\b\220\001L\bð\030@\bpïK\b\001",
optionTable=0x0, namePtr=0x83be230, tkwin=0x0) at tkConfig.c:2280
#1 0xb7d33d5e in FrameWidgetObjCmd (clientData=0x84bf4e8,
interp=0x84b669c, objc=3,
objv=0x8227724) at tkFrame.c:772
#2 0xb7d051c0 in Call_Tk (info=0x8227724, items=3, args=0x8227724) at
tkGlue.c:2283
#3 0xb7d05d63 in XStoWidget (cv=0x0) at tkGlue.c:2662
#4 0x080c174c in Perl_pp_entersub ()
(gdb) l
2275
2276 optionPtr = GetOptionFromObj(interp, namePtr, tablePtr);
2277 if (optionPtr == NULL) {
2278 return NULL;
2279 }
2280 if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) {
2281 optionPtr = optionPtr->extra.synonymPtr;
2282 }
2283 if (optionPtr->specPtr->objOffset >= 0) {
2284 resultPtr = *((Tcl_Obj **) (recordPtr + optionPtr-
Show quoted text
>specPtr->objOffset));
(gdb) print optionPtr
$1 = (Option *) 0x83be230
(gdb) print optionPtr->specPtr
$2 = (const Tk_OptionSpec *) 0x0
(gdb) print optionPtr->specPtr->type
Cannot access memory at address 0x0