summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2002-03-06 15:04:58 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2002-03-06 15:04:58 (GMT)
commitfdc7ed699ce480cbda86351e66d3036105a1eca1 (patch)
treec60aca0a1b14d6a4f761c278c5d1fb00a8c00764
parente4b884c4fa1756e7818c02382f806000cd2ea5e5 (diff)
downloadtcl-fdc7ed699ce480cbda86351e66d3036105a1eca1.zip
tcl-fdc7ed699ce480cbda86351e66d3036105a1eca1.tar.gz
tcl-fdc7ed699ce480cbda86351e66d3036105a1eca1.tar.bz2
tclInt.h: restoring correct operation ordering in TclDecrRefCount
macro [Bug 524802]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclInt.h26
2 files changed, 19 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 7dbb452..eb7c4d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-06 Miguel Sofer <msofer@users.sourceforge.net>
+
+ * generic/tclInt.h: for unshared objects, TclDecrRefCount now
+ frees the internal rep before the string rep - just like the
+ non-macro Tcl_DecrRefCount/TclFreeObj [Bug 524802].
+
2002-03-06 Donal K. Fellows <fellowsd@cs.man.ac.uk>
* doc/lsearch.n: Documentation of new features, plus examples.
diff --git a/generic/tclInt.h b/generic/tclInt.h
index e685e77..a2dc4ac 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.83 2002/02/27 07:08:28 hobbs Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.84 2002/03/06 15:04:58 msofer Exp $
*/
#ifndef _TCLINT
@@ -2201,14 +2201,14 @@ EXTERN int TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp,
if ((objPtr)->refCount < -1) \
panic("Reference count for %lx was negative: %s line %d", \
(objPtr), __FILE__, __LINE__); \
- if (((objPtr)->bytes != NULL) \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
- } \
if (((objPtr)->typePtr != NULL) \
&& ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
} \
+ if (((objPtr)->bytes != NULL) \
+ && ((objPtr)->bytes != tclEmptyStringRep)) { \
+ ckfree((char *) (objPtr)->bytes); \
+ } \
ckfree((char *) (objPtr)); \
TclIncrObjsFreed(); \
}
@@ -2232,14 +2232,14 @@ EXTERN int TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp,
# define TclDecrRefCount(objPtr) \
if (--(objPtr)->refCount <= 0) { \
- if (((objPtr)->bytes != NULL) \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
- } \
if (((objPtr)->typePtr != NULL) \
&& ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
} \
+ if (((objPtr)->bytes != NULL) \
+ && ((objPtr)->bytes != tclEmptyStringRep)) { \
+ ckfree((char *) (objPtr)->bytes); \
+ } \
ckfree((char *) (objPtr)); \
TclIncrObjsFreed(); \
}
@@ -2268,14 +2268,14 @@ extern Tcl_Mutex tclObjMutex;
# define TclDecrRefCount(objPtr) \
if (--(objPtr)->refCount <= 0) { \
- if (((objPtr)->bytes != NULL) \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
- } \
if (((objPtr)->typePtr != NULL) \
&& ((objPtr)->typePtr->freeIntRepProc != NULL)) { \
(objPtr)->typePtr->freeIntRepProc(objPtr); \
} \
+ if (((objPtr)->bytes != NULL) \
+ && ((objPtr)->bytes != tclEmptyStringRep)) { \
+ ckfree((char *) (objPtr)->bytes); \
+ } \
Tcl_MutexLock(&tclObjMutex); \
(objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \
tclFreeObjList = (objPtr); \