#2 gears demo segfaults with Tcl/Tk 8.2.3


I have Tcl/Tk 8.2, Mesa-3.0 and Togl-1.5.
I have narrowed the segfault to two lines in
togl.c, function static int Togl_MakeWindowExist(struct Togl *togl)

When I comment out these two lines out, it works, however
then the program segfaults on exit (in function Tcl_DeleteHashEntry)
// hPtr = Tcl_CreateHashEntry(&winPtr->dispPtr->winTable,
// (char *) winPtr->window, &new_flag);
// Tcl_SetHashValue(hPtr, winPtr);

Perhaps the internal window table structure changed in Tcl 8.2?

Bastian Kleineidam


  • Nobody/Anonymous

    This is not a bug. Togl-1.5 was not updated to use Tcl/Tk 8.2.3. Either upgrade to Togl-1.6 or simply copy the appropriate Tk internal header files that Togl uses from the Tk 8.2.3 source distribution.

  • Lego Andy

    Lego Andy - 2000-04-06

    I tried with TCL/TK 8.1 and 8.2. Same result with all
    demonstration programs as well as with my stuff.

    I have Irix 6.5 and togl 1.6.

  • Nobody/Anonymous

    I have gotten the gears demo to work using the posted comment. With Togl-1.6 and the new tkInt.h, tkPort.h, and tkIntDecls.h (from Tcl/Tk 8.2.1 which I am using) on Solaris 7, I was able to get the gears demo to run. The source to older (and current) versions of Tcl/Tk can be gotten by anonymous FTP from ftp.scriptics.com.

  • Nobody/Anonymous

    I can get the gears demo to run except I'm unable to move the gears with the mouse and closing or removing a gear picture will cause it to crash. I got this far by using the posted comment about commenting out the two lines. I'm using TCL/TK 8.3.1 with togl1.6 (although the same happens with togl1.5) on a WINNT machine.

  • Nobody/Anonymous

    Gears compiles and runs ok on tk8.3

  • geoff michel

    geoff michel - 2003-02-25

    Logged In: YES

    You can also cure the crash rather drastically by adding an
    exithandler (in togl.c):

    togl->Ident = NULL;
    togl->Client_Data = DefaultClientData;
    Tcl_CreateExitHandler((Tcl_ExitProc *) toglexitproc,
    (ClientData) togl);

    and the exit handler is:
    static void
    toglexitproc(ClientData clientData)
    { // added gwm feb 2003 to terminate nicely
    printf("In the togl exitproc");
    exit(1); // and this prevents the crash!

    this terminates with extreme nastiness TCL, but it does
    prevent the annoying crashes. I think that only the exit(1) is
    really necessary!


  • Greg Couch

    Greg Couch - 2007-10-24
    • status: open --> closed-out-of-date
  • Greg Couch

    Greg Couch - 2007-10-24

    Logged In: YES
    Originator: NO

    Last comment claims it is not a bug. I successfully use Tcl/Tk 8.4, Mesa-6.5, and Togl 2.0-cvs, so I believe this bug is fixed.


Log in to post a comment.