Posted to tcl by kbk at Mon Apr 30 18:57:13 GMT 2007view pretty

Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.112
diff -u -b -u -r1.112 tclProc.c
--- generic/tclProc.c   25 Apr 2007 21:59:28 -0000      1.112
+++ generic/tclProc.c   30 Apr 2007 18:55:45 -0000
@@ -230,7 +230,8 @@
         * cannot assume that 'line' is valid here, we have to check.
         */
  
-       if ((context.type == TCL_LOCATION_SOURCE) && context.line
+       if (context.type == TCL_LOCATION_SOURCE) {
+           if (context.line
                && (context.nline >= 4) && (context.line[3] >= 0)) {
            int isNew;
            CmdFrame *cfPtr = (CmdFrame *) ckalloc(sizeof(CmdFrame));
@@ -245,6 +246,7 @@
  
            if (context.type == TCL_LOCATION_SOURCE) {
                cfPtr->data.eval.path = context.data.eval.path;
+                   Tcl_IncrRefCount(cfPtr->data.eval.path);
  
                /*
                 * Transfer of reference. The reference going away (release of
@@ -260,7 +262,10 @@
            cfPtr->cmd.str.len = 0;
  
            Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->linePBodyPtr,
-                   (char *) procPtr, &isNew), cfPtr);
+                                                    (char *) procPtr, &isNew),
+                                cfPtr);
+           }
+           Tcl_DecrRefCount(context.data.eval.path);
        }
     }