summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-08-23 00:08:45 (GMT)
committerhobbs <hobbs>2000-08-23 00:08:45 (GMT)
commit58aa030aa0300ffe286772d5244a10291f0e0ce8 (patch)
tree778613206d715a9867d7df5ad4d220824d25d3c4
parent1cdb37f18ebe1de21b3b69b9bed5a486e30c8a7a (diff)
downloadtk-58aa030aa0300ffe286772d5244a10291f0e0ce8.zip
tk-58aa030aa0300ffe286772d5244a10291f0e0ce8.tar.gz
tk-58aa030aa0300ffe286772d5244a10291f0e0ce8.tar.bz2
* generic/tkButton.c (ButtonTextVarProc): changed order of
incr/decr of new value object, in case they are equal.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkButton.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 648f4d3..4c6da5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-22 Jeff Hobbs <hobbs@scriptics.com>
+
+ * generic/tkButton.c (ButtonTextVarProc): changed order of
+ incr/decr of new value object, in case they are equal.
+
2000-08-18 Eric Melski <ericm@ajubasolutions.com>
* generic/tkImgPhoto.c (ImgPhotoGet): Removed redundant call to
diff --git a/generic/tkButton.c b/generic/tkButton.c
index b539552..e761137 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.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: tkButton.c,v 1.8 2000/05/25 16:57:23 ericm Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.9 2000/08/23 00:08:45 hobbs Exp $
*/
#include "tkButton.h"
@@ -1645,9 +1645,14 @@ ButtonTextVarProc(clientData, interp, name1, name2, flags)
if (valuePtr == NULL) {
valuePtr = Tcl_NewObj();
}
- Tcl_DecrRefCount(butPtr->textPtr);
+ /*
+ * Incr valuePtr before Decr, in case they point to the same object.
+ * We could also do some short-circuiting in that case, but it
+ * shouldn't happen in practice.
+ */
+ Tcl_IncrRefCount(valuePtr);
butPtr->textPtr = valuePtr;
- Tcl_IncrRefCount(butPtr->textPtr);
+ Tcl_DecrRefCount(butPtr->textPtr);
TkpComputeButtonGeometry(butPtr);
if ((butPtr->tkwin != NULL) && Tk_IsMapped(butPtr->tkwin)