summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-06-16 20:27:22 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-06-16 20:27:22 (GMT)
commit07169bb2f60d244e9083a77c24fff0f964502568 (patch)
tree5ae5eec341086dec67ad6bcd0cc66069518f6f46
parentfbcd87e044a689ee654c0848842691e3c871730d (diff)
downloadtk-07169bb2f60d244e9083a77c24fff0f964502568.zip
tk-07169bb2f60d244e9083a77c24fff0f964502568.tar.gz
tk-07169bb2f60d244e9083a77c24fff0f964502568.tar.bz2
New attempt to fix Bug 3062331
-rw-r--r--generic/ttk/ttkTrace.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index 0128a1d..a469d0b 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -44,6 +44,11 @@ VarTraceProc(
* If the variable is being unset, then re-establish the trace:
*/
if (flags & TCL_TRACE_DESTROYED) {
+ if (tracePtr->interp == NULL) {
+ Tcl_DecrRefCount(tracePtr->varnameObj);
+ ckfree((ClientData)tracePtr);
+ return NULL;
+ }
Tcl_TraceVar(interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
VarTraceProc, clientData);
@@ -104,6 +109,18 @@ Ttk_TraceHandle *Ttk_TraceVariable(
void Ttk_UntraceVariable(Ttk_TraceHandle *h)
{
if (h) {
+ ClientData cd = NULL;
+
+ while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj),
+ 0, VarTraceProc, cd)) != NULL) {
+ if (cd == (ClientData) h) {
+ break;
+ }
+ }
+ if (cd == NULL) {
+ h->interp = NULL;
+ return;
+ }
Tcl_UntraceVar(h->interp, Tcl_GetString(h->varnameObj),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
VarTraceProc, (ClientData)h);