summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-04-03 15:03:59 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-04-03 15:03:59 (GMT)
commit711464eba9249a177454befecc9f7f90e13887b8 (patch)
tree5bf28e2d8d7006914c565b571ba607a7ef5a864f
parent8cfd70638999b67e37edba6967467a2ece7a91fe (diff)
downloadtcl-711464eba9249a177454befecc9f7f90e13887b8.zip
tcl-711464eba9249a177454befecc9f7f90e13887b8.tar.gz
tcl-711464eba9249a177454befecc9f7f90e13887b8.tar.bz2
* generic/tclNamesp.c: Revised ErrorCodeRead and ErrorInfoRead
trace routines so they guarantee the ::errorCode and ::errorInfo variable always appear to exist. [Bug 1693252].
-rw-r--r--generic/tclNamesp.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index e5587fb..5c81b56 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -22,7 +22,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.128 2007/04/02 18:48:04 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.129 2007/04/03 15:03:59 dgp Exp $
*/
#include "tclInt.h"
@@ -622,11 +622,18 @@ ErrorCodeRead(
{
Interp *iPtr = (Interp *)interp;
- if (flags & TCL_INTERP_DESTROYED || iPtr->errorCode == NULL) {
+ if (flags & TCL_INTERP_DESTROYED) {
return NULL;
}
- Tcl_ObjSetVar2(interp, iPtr->ecVar, NULL, iPtr->errorCode,
- TCL_GLOBAL_ONLY);
+ if (iPtr->errorCode) {
+ Tcl_ObjSetVar2(interp, iPtr->ecVar, NULL,
+ iPtr->errorCode, TCL_GLOBAL_ONLY);
+ return NULL;
+ }
+ if (NULL == Tcl_ObjGetVar2(interp, iPtr->ecVar, NULL, TCL_GLOBAL_ONLY)) {
+ Tcl_ObjSetVar2(interp, iPtr->ecVar, NULL,
+ Tcl_NewObj(), TCL_GLOBAL_ONLY);
+ }
return NULL;
}
@@ -689,11 +696,18 @@ ErrorInfoRead(
{
Interp *iPtr = (Interp *)interp;
- if (flags & TCL_INTERP_DESTROYED || iPtr->errorInfo == NULL) {
+ if (flags & TCL_INTERP_DESTROYED) {
return NULL;
}
- Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL, iPtr->errorInfo,
- TCL_GLOBAL_ONLY);
+ if (iPtr->errorInfo) {
+ Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL,
+ iPtr->errorInfo, TCL_GLOBAL_ONLY);
+ return NULL;
+ }
+ if (NULL == Tcl_ObjGetVar2(interp, iPtr->eiVar, NULL, TCL_GLOBAL_ONLY)) {
+ Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL,
+ Tcl_NewObj(), TCL_GLOBAL_ONLY);
+ }
return NULL;
}