[Pkg-tcltk-devel] Bug#462409: Bug#462409: Tcl_DecrRefCount () SIGSEGVs on a result of Tcl_NewDictObj ()

Ivan Shmakov oneingray at gmail.com
Fri Jan 25 06:50:40 UTC 2008


>>>>> Sergei Golovan <sgolovan at nes.ru> writes:

 >> The test program below catches a SIGSEGV when trying to
 >> Tcl_DecrRefCount () on a Tcl `dict' object: I see no mention of such
 >> a behaviour as an appropriate one in the documentation as well.

 > (After some chatting with Miguel Sofer in Tcler's chatroom)

 > It's likely a documentation bug. It isn't clear from the docs that
 > the first thing you have to do is calling TclInitSubsystems().

        Yes, the documentation should state it explicitly.

 > It is possible only indirectly via calling Tcl_FindExecutable() or
 > Tcl_CreateInterp(). So, adding any of these two function calls at the
 > very beginning of main() makes crash gone.

 > See
 > http://aspn.activestate.com/ASPN/Mail/Message/perl-unix-users/2245821
 > for more detailed explanation.

        Thanks, I've added the following to my program and it seems to
        work correctly.

static void
ensure_tcl_initialized (void)
{
    static tcl_initialized_p = 0;

    if (! tcl_initialized_p) {
        /* NB: a hack, as per Debian Bug#462409 */
        Tcl_Interp *interp = Tcl_CreateInterp ();
        assert (interp != 0);
        Tcl_DeleteInterp (interp);
        tcl_initialized_p = 1;
    }

    /* . */
}





More information about the Pkg-tcltk-devel mailing list