diff options
Diffstat (limited to 'generic/ttk/ttkButton.c')
-rw-r--r-- | generic/ttk/ttkButton.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index bc44f25..9067f71 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -480,12 +480,13 @@ static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; - Ttk_TraceHandle *vt = Ttk_TraceVariable( - interp, checkPtr->checkbutton.variableObj, - CheckbuttonVariableChanged, checkPtr); + Tcl_Obj *varName = checkPtr->checkbutton.variableObj; + Ttk_TraceHandle *vt = 0; - if (!vt) { - return TCL_ERROR; + if (varName != NULL && *Tcl_GetString(varName) != '\0') { + vt = Ttk_TraceVariable(interp, varName, + CheckbuttonVariableChanged, checkPtr); + if (!vt) return TCL_ERROR; } if (BaseConfigure(interp, recordPtr, mask) != TCL_OK){ @@ -493,7 +494,9 @@ CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) return TCL_ERROR; } - Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); + if (checkPtr->checkbutton.variableTrace) { + Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); + } checkPtr->checkbutton.variableTrace = vt; return TCL_OK; |