summaryrefslogtreecommitdiffstats
path: root/generic/tclTrace.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-10-05 18:14:24 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-10-05 18:14:24 (GMT)
commiteab3283014b276dd97ea9817fb75bf47c6181959 (patch)
tree88717c7d63e6416c4f15a3f6e1c96edd873699dc /generic/tclTrace.c
parentafd7b17255862ddee543ced29fb8e728965cf992 (diff)
downloadtcl-eab3283014b276dd97ea9817fb75bf47c6181959.zip
tcl-eab3283014b276dd97ea9817fb75bf47c6181959.tar.gz
tcl-eab3283014b276dd97ea9817fb75bf47c6181959.tar.bz2
* generic/tclBasic.c (Tcl_CreateInterp,Tcl_DeleteInterp,
TclEvalObjvInternal,Tcl_LogCommandInfo): * generic/tclCmdAH.c (Tcl_CatchObjCmd): * generic/tclEvent.c (BgError,Tcl_BackgroundError,HandleBgErrors): * generic/tclInt.h (Interp, ERROR_CODE_SET): * generic/tclNamesp.c (Tcl_CreateNamespace,Tcl_DeleteNamespace,TclTeardownNamespace): * generic/tclResult.c (Tcl_ResetResult,Tcl_SetObjErrorCode,TclTransferResult): * generic/tclTrace.c (CallVarTraces): Reworked management of the "errorCode" data of an interp. That information is now primarily stored in a new private (Tcl_Obj *) field of the Interp struct, rather than using a global variable ::errorCode as the primary storage. The ERROR_CODE_SET flag bit value is no longer required to manage the value in its new location, and is removed. Variable traces are established to support compatibility for any code expecting the ::errorCode variable to hold the information.
Diffstat (limited to 'generic/tclTrace.c')
-rw-r--r--generic/tclTrace.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 91cd63d..dc8cbd3 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTrace.c,v 1.13 2004/10/01 00:10:23 dgp Exp $
+ * RCS: @(#) $Id: tclTrace.c,v 1.14 2004/10/05 18:14:28 dgp Exp $
*/
#include "tclInt.h"
@@ -2451,7 +2451,12 @@ TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2, flags, leaveErrMsg)
int code = TCL_OK;
int disposeFlags = 0;
int saveErrFlags = iPtr->flags
- & (ERR_IN_PROGRESS | ERR_ALREADY_LOGGED | ERROR_CODE_SET);
+ & (ERR_IN_PROGRESS | ERR_ALREADY_LOGGED);
+ Tcl_Obj *saveErrCode = iPtr->errorCode;
+
+ if (saveErrCode) {
+ Tcl_IncrRefCount(saveErrCode);
+ }
/*
* If there are already similar trace procedures active for the
@@ -2576,6 +2581,12 @@ TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2, flags, leaveErrMsg)
done:
if (code == TCL_OK) {
iPtr->flags |= saveErrFlags;
+ if (iPtr->errorCode) {
+ Tcl_DecrRefCount(iPtr->errorCode);
+ }
+ iPtr->errorCode = saveErrCode;
+ } else if (saveErrCode) {
+ Tcl_DecrRefCount(saveErrCode);
}
if (code == TCL_ERROR) {
if (leaveErrMsg) {