diff options
| author | Miguel Sofer <miguel.sofer@gmail.com> | 2005-10-23 22:01:27 (GMT) |
|---|---|---|
| committer | Miguel Sofer <miguel.sofer@gmail.com> | 2005-10-23 22:01:27 (GMT) |
| commit | 64be4c1e63ef85d515bb28afe134159d649353f6 (patch) | |
| tree | c2da79f4e5a542014dab31edea47e6bd46a22b4c /generic/tclMain.c | |
| parent | ab628d4d6d0cbf74b48df435b3d8a2675cc8a0ee (diff) | |
| download | tcl-64be4c1e63ef85d515bb28afe134159d649353f6.zip tcl-64be4c1e63ef85d515bb28afe134159d649353f6.tar.gz tcl-64be4c1e63ef85d515bb28afe134159d649353f6.tar.bz2 | |
* generic/tclBasic.c:
* generic/tclBinary.c:
* generic/tclCmdAH.c:
* generic/tclCmdIL.c:
* generic/tclCmdMZ.c:
* generic/tclExecute.c:
* generic/tclLink.c:
* generic/tclMain.c:
* generic/tclProc.c:
* generic/tclScan.c:
* generic/tclTest.c:
* generic/tclVar.c:
* mac/tclMacInit.c:
* unix/tclUnixInit.c:
* win/tclWinInit.c: Insure that the core never calls TclPtrSetVar,
Tcl_SetVar2Ex, Tcl_ObjSetVar2 or Tcl_SetObjErrorCode with a 0-ref
new value. It is not possible to handle error returns correctly in
that case [Bug 1334947], one has the choice of leaking the object
in some cases, or else risk crashing in some others.
Diffstat (limited to 'generic/tclMain.c')
| -rw-r--r-- | generic/tclMain.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index 1b73be6..2847bd8 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMain.c,v 1.20.2.1 2005/09/30 19:28:55 dgp Exp $ + * RCS: @(#) $Id: tclMain.c,v 1.20.2.2 2005/10/23 22:01:30 msofer Exp $ */ #include "tcl.h" @@ -210,6 +210,7 @@ Tcl_Main(argc, argv, appInitProc) Tcl_Channel inChannel, outChannel, errChannel; Tcl_Interp *interp; Tcl_DString appName; + Tcl_Obj *objPtr; Tcl_FindExecutable(argv[0]); @@ -241,8 +242,11 @@ Tcl_Main(argc, argv, appInitProc) argc--; argv++; - Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewIntObj(argc), TCL_GLOBAL_ONLY); - + objPtr = Tcl_NewIntObj(argc); + Tcl_IncrRefCount(objPtr); + Tcl_SetVar2Ex(interp, "argc", NULL, objPtr, TCL_GLOBAL_ONLY); + Tcl_DecrRefCount(objPtr); + argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { Tcl_DString ds; @@ -251,7 +255,9 @@ Tcl_Main(argc, argv, appInitProc) Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); Tcl_DStringFree(&ds); } + Tcl_IncrRefCount(argvPtr); Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY); + Tcl_DecrRefCount(argvPtr); /* * Set the "tcl_interactive" variable. |
