summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-01-07 14:20:54 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-01-07 14:20:54 (GMT)
commitfab28a593acf8b1275639cc233b2a498a4798695 (patch)
tree53546a6aafa9eeaffee8951ed14b5dd4663e1927
parent5355f88a118d91aed81f72a271e3745edef23006 (diff)
downloadtk-fab28a593acf8b1275639cc233b2a498a4798695.zip
tk-fab28a593acf8b1275639cc233b2a498a4798695.tar.gz
tk-fab28a593acf8b1275639cc233b2a498a4798695.tar.bz2
Correct handling of refcount in ProgressbarStepCommand. Patch from Christian Werner.
-rw-r--r--generic/ttk/ttkProgress.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 4dc50a2..6c13992 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -421,21 +421,23 @@ static int ProgressbarStepCommand(
}
newValueObj = Tcl_NewDoubleObj(value);
+ Tcl_IncrRefCount(newValueObj);
TtkRedisplayWidget(&pb->core);
/* Update value by setting the linked -variable, if there is one:
*/
if (pb->progress.variableTrace) {
- return Tcl_ObjSetVar2(
- interp, pb->progress.variableObj, 0, newValueObj,
- TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)
- ? TCL_OK : TCL_ERROR;
+ int result = Tcl_ObjSetVar2(
+ interp, pb->progress.variableObj, 0, newValueObj,
+ TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)
+ ? TCL_OK : TCL_ERROR;
+ Tcl_DecrRefCount(newValueObj);
+ return result;
}
/* Otherwise, change the -value directly:
*/
- Tcl_IncrRefCount(newValueObj);
Tcl_DecrRefCount(pb->progress.valueObj);
pb->progress.valueObj = newValueObj;
CheckAnimation(pb);