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

dgp at nist.gov dgp at nist.gov
Fri Jan 25 15:28:36 UTC 2008


Quoting Ivan Shmakov <oneingray at gmail.com>:
>         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;
>     }
> 
>     /* . */
> }

That's fine, but a simple

    Tcl_FindExecutable(NULL);

would work just as well.

Going a bit further,

    Tcl_FindExecutable(argv[0]);

in your main() would have the added
benefit of making Tcl's [info nameofexecutable]
command return a correct result.

DGP





More information about the Pkg-tcltk-devel mailing list