summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-05-29 21:53:15 (GMT)
committerhobbs <hobbs>2006-05-29 21:53:15 (GMT)
commita7c8588873469c05f9182cd88d68fce9eec6ebe5 (patch)
tree555c90252ea8ee86d815c4c8596bc70c26d63ec7 /generic
parent44ccf98fa2005473a580551f5cd3e2ed43075fdc (diff)
downloadtk-a7c8588873469c05f9182cd88d68fce9eec6ebe5.zip
tk-a7c8588873469c05f9182cd88d68fce9eec6ebe5.tar.gz
tk-a7c8588873469c05f9182cd88d68fce9eec6ebe5.tar.bz2
* tests/entry.test (entry-22.1):
* tests/listbox.test (listbox-6.15): * generic/tkListbox.c (ListboxInsertSubCmd, ListboxDeleteSubCmd): Ignore Tcl_SetVar2Ex failure of listVarName, similar to entry widget handling. [Bug 1424513]
Diffstat (limited to 'generic')
-rw-r--r--generic/tkListbox.c56
1 files changed, 17 insertions, 39 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 8856fa0..78cf3c9 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkListbox.c,v 1.34 2005/11/17 16:21:55 dkf Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.35 2006/05/29 21:53:16 hobbs Exp $
*/
#include "tkPort.h"
@@ -2321,30 +2321,19 @@ ListboxInsertSubCmd(listPtr, index, objc, objv)
return result;
}
- Tcl_IncrRefCount(newListObj);
-
/*
- * Clean up the old reference.
+ * Replace the current object and set attached listvar, if any.
+ * This may error if listvar points to a var in a deleted namespace, but
+ * we ignore those errors. If the namespace is recreated, it will
+ * auto-sync with the current value. [Bug 1424513]
*/
+ Tcl_IncrRefCount(newListObj);
Tcl_DecrRefCount(listPtr->listObj);
-
- /*
- * Set the internal pointer to the new obj.
- */
-
listPtr->listObj = newListObj;
-
- /*
- * If there is a listvar, make sure it points at the new object.
- */
-
if (listPtr->listVarName != NULL) {
- if (Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
- NULL, newListObj, TCL_GLOBAL_ONLY) == NULL) {
- Tcl_DecrRefCount(newListObj);
- return TCL_ERROR;
- }
+ Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
+ (char *) NULL, listPtr->listObj, TCL_GLOBAL_ONLY);
}
/*
@@ -2495,19 +2484,20 @@ ListboxDeleteSubCmd(listPtr, first, last)
return result;
}
- Tcl_IncrRefCount(newListObj);
-
/*
- * Clean up the old reference.
+ * Replace the current object and set attached listvar, if any.
+ * This may error if listvar points to a var in a deleted namespace, but
+ * we ignore those errors. If the namespace is recreated, it will
+ * auto-sync with the current value. [Bug 1424513]
*/
+ Tcl_IncrRefCount(newListObj);
Tcl_DecrRefCount(listPtr->listObj);
-
- /*
- * Set the internal pointer to the new obj.
- */
-
listPtr->listObj = newListObj;
+ if (listPtr->listVarName != NULL) {
+ Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
+ (char *) NULL, listPtr->listObj, TCL_GLOBAL_ONLY);
+ }
/*
* Get the new list length.
@@ -2516,18 +2506,6 @@ ListboxDeleteSubCmd(listPtr, first, last)
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
/*
- * If there is a listvar, make sure it points at the new object.
- */
-
- if (listPtr->listVarName != NULL) {
- if (Tcl_SetVar2Ex(listPtr->interp, listPtr->listVarName,
- NULL, newListObj, TCL_GLOBAL_ONLY) == NULL) {
- Tcl_DecrRefCount(newListObj);
- return TCL_ERROR;
- }
- }
-
- /*
* Update the selection and viewing information to reflect the change in
* the element numbering, and redisplay to slide information up over the
* elements that were deleted.