summaryrefslogtreecommitdiffstats
path: root/generic/tkMenubutton.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-16 09:18:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-16 09:18:45 (GMT)
commit9e6d6d1ae2e12e39197ebabb4a4fd27715f65f5f (patch)
treee18d0330f474c0037d69499dd4ccbc505b1203a8 /generic/tkMenubutton.c
parentcdb0df2ccb91f62869444148376ce5889bd755b3 (diff)
parentcdf0d2aad93208954b01d2446181854ba1221482 (diff)
downloadtk-9e6d6d1ae2e12e39197ebabb4a4fd27715f65f5f.zip
tk-9e6d6d1ae2e12e39197ebabb4a4fd27715f65f5f.tar.gz
tk-9e6d6d1ae2e12e39197ebabb4a4fd27715f65f5f.tar.bz2
Merge 8.6
Diffstat (limited to 'generic/tkMenubutton.c')
-rw-r--r--generic/tkMenubutton.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index fa5b63f..25583be 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,