Imported Tk 8.6.9
This commit is contained in:
@@ -1565,7 +1565,7 @@ ConfigureListbox(
|
||||
Tcl_Obj *errorResult = NULL;
|
||||
int oldExport, error;
|
||||
|
||||
oldExport = listPtr->exportSelection;
|
||||
oldExport = (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp));
|
||||
if (listPtr->listVarName != NULL) {
|
||||
Tcl_UntraceVar2(interp, listPtr->listVarName, NULL,
|
||||
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
|
||||
@@ -1607,10 +1607,11 @@ ConfigureListbox(
|
||||
|
||||
/*
|
||||
* Claim the selection if we've suddenly started exporting it and
|
||||
* there is a selection to export.
|
||||
* there is a selection to export and this interp is unsafe.
|
||||
*/
|
||||
|
||||
if (listPtr->exportSelection && !oldExport
|
||||
if (listPtr->exportSelection && (!oldExport)
|
||||
&& (!Tcl_IsSafe(listPtr->interp))
|
||||
&& (listPtr->numSelected != 0)) {
|
||||
Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY,
|
||||
ListboxLostSelection, listPtr);
|
||||
@@ -3079,7 +3080,8 @@ ListboxSelect(
|
||||
EventuallyRedrawRange(listPtr, first, last);
|
||||
}
|
||||
if ((oldCount == 0) && (listPtr->numSelected > 0)
|
||||
&& listPtr->exportSelection) {
|
||||
&& (listPtr->exportSelection)
|
||||
&& (!Tcl_IsSafe(listPtr->interp))) {
|
||||
Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY,
|
||||
ListboxLostSelection, listPtr);
|
||||
}
|
||||
@@ -3125,7 +3127,7 @@ ListboxFetchSelection(
|
||||
const char *stringRep;
|
||||
Tcl_HashEntry *entry;
|
||||
|
||||
if (!listPtr->exportSelection) {
|
||||
if ((!listPtr->exportSelection) || Tcl_IsSafe(listPtr->interp)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3196,7 +3198,8 @@ ListboxLostSelection(
|
||||
{
|
||||
register Listbox *listPtr = clientData;
|
||||
|
||||
if ((listPtr->exportSelection) && (listPtr->nElements > 0)) {
|
||||
if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp))
|
||||
&& (listPtr->nElements > 0)) {
|
||||
ListboxSelect(listPtr, 0, listPtr->nElements-1, 0);
|
||||
GenerateListboxSelectEvent(listPtr);
|
||||
}
|
||||
@@ -3428,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;
|
||||
@@ -3437,6 +3440,19 @@ ListboxListVarProc(
|
||||
int oldLength, i;
|
||||
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!
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user