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/tkMenu.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/tkMenu.c')
-rw-r--r-- | generic/tkMenu.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 74fab67..33b548d 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -2492,9 +2492,10 @@ MenuVarProc( const char *value; const char *name, *onValue; - if (flags & TCL_INTERP_DESTROYED) { + if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) { /* - * Do nothing if the interpreter is going away. + * Do nothing if the interpreter is going away or we have + * no variable name. */ return NULL; @@ -2506,17 +2507,6 @@ MenuVarProc( return NULL; } - /* - * See ticket [5d991b82]. - */ - - if (mePtr->namePtr == NULL) { - Tcl_UntraceVar2(interp, name1, name2, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuVarProc, clientData); - return NULL; - } - name = Tcl_GetString(mePtr->namePtr); /* @@ -2524,12 +2514,29 @@ MenuVarProc( */ if (flags & TCL_TRACE_UNSETS) { + ClientData probe = NULL; mePtr->entryFlags &= ~ENTRY_SELECTED; - if (flags & TCL_TRACE_DESTROYED) { - Tcl_TraceVar2(interp, name, NULL, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuVarProc, clientData); - } + + do { + probe = Tcl_VarTraceInfo(interp, name, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + MenuVarProc, probe); + if (probe == (ClientData)mePtr) { + break; + } + } while (probe); + if (probe) { + /* + * We were able to fetch the unset trace for our + * namePtr, 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_TraceVar2(interp, name, NULL, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + MenuVarProc, clientData); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, NULL); return NULL; |