summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogel@noemail.net>2016-02-24 17:32:24 (GMT)
committerfvogel <fvogel@noemail.net>2016-02-24 17:32:24 (GMT)
commit356bec1a6c16a27d7958cb08bfcbe52db0ea6bc1 (patch)
treea2872eed910efedce574271dbc3abcf3f5590332
parent0875f41dc0e039fcd8f4ec857947a3639b061fac (diff)
downloadtk-356bec1a6c16a27d7958cb08bfcbe52db0ea6bc1.zip
tk-356bec1a6c16a27d7958cb08bfcbe52db0ea6bc1.tar.gz
tk-356bec1a6c16a27d7958cb08bfcbe52db0ea6bc1.tar.bz2
Fixed bug [2262543] - Scale widget unexpectedly fires command callback
FossilOrigin-Name: 091c6063c8b04e794f105165d80cf019b7e92809
-rw-r--r--generic/tkScale.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index cc7c294..cbc5202 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -303,6 +303,12 @@ Tk_ScaleObjCmd(
return TCL_ERROR;
}
+ /*
+ * The widget was just created, no command callback must be invoked.
+ */
+
+ scalePtr->flags &= ~INVOKE_COMMAND;
+
Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -1268,7 +1274,14 @@ TkScaleSetValue(
return;
}
scalePtr->value = value;
- if (invokeCommand) {
+
+ /*
+ * Schedule command callback invocation only if there is such a command
+ * already registered, otherwise the callback would trigger later when
+ * configuring the widget -command option even if the value did not change.
+ */
+
+ if ((invokeCommand) && (scalePtr->command != NULL)) {
scalePtr->flags |= INVOKE_COMMAND;
}
TkEventuallyRedrawScale(scalePtr, REDRAW_SLIDER);