diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-05 21:25:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-05 21:25:58 (GMT) |
commit | 72a4eea4cdef1059da99c87ce25a4c2db0972743 (patch) | |
tree | 6790e6d682322d159d06bb18662acb801d63725c /generic/tkMenubutton.c | |
parent | ebee84d3759fbe688f9a527facf83e5dc30ae5a0 (diff) | |
parent | 329a1085f6a67610625d3e03c3650852ae5575b6 (diff) | |
download | tk-72a4eea4cdef1059da99c87ce25a4c2db0972743.zip tk-72a4eea4cdef1059da99c87ce25a4c2db0972743.tar.gz tk-72a4eea4cdef1059da99c87ce25a4c2db0972743.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tkMenubutton.c')
-rw-r--r-- | generic/tkMenubutton.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 65883c0..4cf102f 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -882,25 +882,32 @@ MenuButtonTextVarProc( unsigned len; /* - * See ticket [5d991b82]. - */ - - if (mbPtr->textVarName == NULL) { - if (!(flags & TCL_INTERP_DESTROYED)) { - Tcl_UntraceVar2(interp, name1, name2, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuButtonTextVarProc, clientData); - } - return NULL; - } - - /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { - if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) { + if (!Tcl_InterpDeleted(interp) && mbPtr->textVarName) { + ClientData probe = NULL; + + do { + probe = Tcl_VarTraceInfo(interp, + mbPtr->textVarName, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + MenuButtonTextVarProc, probe); + if (probe == (ClientData)mbPtr) { + break; + } + } while (probe); + if (probe) { + /* + * We were able to fetch the unset trace for our + * textVarName, which means it is not unset and not + * the cause of this unset trace. Instead some outdated + * former variable must be, and we should ignore it. + */ + return NULL; + } Tcl_SetVar2(interp, mbPtr->textVarName, NULL, mbPtr->text, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, mbPtr->textVarName, NULL, |