diff options
author | fvogel <fvogelnew1@free.fr> | 2018-02-04 17:34:46 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2018-02-04 17:34:46 (GMT) |
commit | 2be40cc4e26ab6ae2c5cdb3e85551e7bda1bfe69 (patch) | |
tree | 4d11bc5e5c3def084bffe3e79a4ccad763f92bf2 /generic | |
parent | b34e6a51cbf361f34517412d1060da4af1a44187 (diff) | |
parent | f03f24b4fea573c6aa66e02273d26795202380c2 (diff) | |
download | tk-2be40cc4e26ab6ae2c5cdb3e85551e7bda1bfe69.zip tk-2be40cc4e26ab6ae2c5cdb3e85551e7bda1bfe69.tar.gz tk-2be40cc4e26ab6ae2c5cdb3e85551e7bda1bfe69.tar.bz2 |
Fix [5d991b822e]: segmentation violation in TclObjLookupVarEx. Patch from Christian Werner.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkButton.c | 30 | ||||
-rw-r--r-- | generic/tkEntry.c | 17 | ||||
-rw-r--r-- | generic/tkListbox.c | 17 | ||||
-rw-r--r-- | generic/tkMenu.c | 11 | ||||
-rw-r--r-- | generic/tkMenubutton.c | 13 | ||||
-rw-r--r-- | generic/tkMessage.c | 13 | ||||
-rw-r--r-- | generic/tkScale.c | 13 | ||||
-rw-r--r-- | generic/ttk/ttkTrace.c | 15 |
8 files changed, 121 insertions, 8 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c index b7e314e..e114a51 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -1611,6 +1611,19 @@ ButtonVarProc( Tcl_Obj *valuePtr; /* + * See ticket [5d991b82]. + */ + + if (butPtr->selVarNamePtr == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + ButtonVarProc, clientData); + } + return NULL; + } + + /* * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ @@ -1692,8 +1705,8 @@ static char * ButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Not used. */ - const char *name2, /* Not used. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkButton *butPtr = clientData; @@ -1704,6 +1717,19 @@ ButtonTextVarProc( } /* + * See ticket [5d991b82]. + */ + + if (butPtr->textVarNamePtr == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + ButtonTextVarProc, clientData); + } + return NULL; + } + + /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9a2f900..6344df2 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -3137,8 +3137,8 @@ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Not used. */ - const char *name2, /* Not used. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Entry *entryPtr = clientData; @@ -3152,6 +3152,19 @@ EntryTextVarProc( } /* + * See ticket [5d991b82]. + */ + + if (entryPtr->textVarName == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + EntryTextVarProc, clientData); + } + return NULL; + } + + /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index b18a7f4..5f650fe 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -3431,8 +3431,8 @@ static char * ListboxListVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Not used. */ - const char *name2, /* Not used. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Listbox *listPtr = clientData; @@ -3441,6 +3441,19 @@ ListboxListVarProc( Tcl_HashEntry *entry; /* + * See ticket [5d991b82]. + */ + + if (listPtr->listVarName == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + ListboxListVarProc, clientData); + } + return NULL; + } + + /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! */ diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 0dcc1c2..9e6f37a 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -2500,6 +2500,17 @@ 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); /* diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 1a4d5ae..2c1676c 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -882,6 +882,19 @@ 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. */ diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 2b71998..f65b046 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -839,6 +839,19 @@ MessageTextVarProc( const char *value; /* + * See ticket [5d991b82]. + */ + + if (msgPtr->textVarName == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + MessageTextVarProc, clientData); + } + return NULL; + } + + /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ diff --git a/generic/tkScale.c b/generic/tkScale.c index ef67630..af45afa 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -1193,6 +1193,19 @@ ScaleVarProc( int result; /* + * See ticket [5d991b82]. + */ + + if (scalePtr->varNamePtr == NULL) { + if (!(flags & TCL_INTERP_DESTROYED)) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + ScaleVarProc, clientData); + } + return NULL; + } + + /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index c0f17cf..c8bbdaf 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -26,8 +26,8 @@ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* (unused) */ - const char *name2, /* (unused) */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = clientData; @@ -38,6 +38,17 @@ VarTraceProc( return NULL; } + /* + * See ticket [5d991b82]. + */ + + if (tracePtr->varnameObj == NULL) { + Tcl_UntraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + VarTraceProc, clientData); + return NULL; + } + name = Tcl_GetString(tracePtr->varnameObj); /* |