summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-05-29 21:52:47 (GMT)
committerhobbs <hobbs>2006-05-29 21:52:47 (GMT)
commitdcbc6a924df98189a6e36d8b02cd5359f54cca3c (patch)
treee8601b4d9d9447943bc935ddbbb8246e8ed71a56 /generic
parent702c54e25c9250901b3bfe5171e9c4ac5dad6916 (diff)
downloadtk-dcbc6a924df98189a6e36d8b02cd5359f54cca3c.zip
tk-dcbc6a924df98189a6e36d8b02cd5359f54cca3c.tar.gz
tk-dcbc6a924df98189a6e36d8b02cd5359f54cca3c.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.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index fd02a27..43342c4 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.29.2.2 2004/06/08 20:11:18 dgp Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.29.2.3 2006/05/29 21:52:47 hobbs Exp $
*/
#include "tkPort.h"
@@ -2284,25 +2284,24 @@ ListboxInsertSubCmd(listPtr, index, objc, objv)
return result;
}
+ /*
+ * 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);
- /* Clean up the old reference */
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,
- (char *)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);
}
/* Get the new list length */
Tcl_ListObjLength(listPtr->interp, listPtr->listObj, &listPtr->nElements);
-
+
/*
* Update the "special" indices (anchor, topIndex, active) to account
* for the renumbering that just occurred. Then arrange for the new
@@ -2433,24 +2432,23 @@ ListboxDeleteSubCmd(listPtr, first, last)
return result;
}
+ /*
+ * 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);
- /* Clean up the old reference */
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 */
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,
- (char *)NULL, newListObj, TCL_GLOBAL_ONLY) == NULL) {
- Tcl_DecrRefCount(newListObj);
- return TCL_ERROR;
- }
- }
/*
* Update the selection and viewing information to reflect the change