summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkConfig.c11
-rw-r--r--generic/tkTest.c9
-rw-r--r--tests/config.test12
3 files changed, 14 insertions, 18 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 1cfe1fb..113b3a1 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -330,16 +330,9 @@ Tk_DeleteOptionTable(
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
int count;
- ThreadSpecificData *tsdPtr =
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- if (tablePtr->refCount > 1) {
- tablePtr->refCount--;
- return;
- }
- if (!tsdPtr->initialized || !Tcl_FindHashEntry(&tsdPtr->hashTable,
- tablePtr->hashEntryPtr)) {
+ tablePtr->refCount--;
+ if (tablePtr->refCount!=0) {
return;
}
diff --git a/generic/tkTest.c b/generic/tkTest.c
index a951a57..8146c69 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -497,11 +497,11 @@ TestobjconfigObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const options[] = {
- "alltypes", "chain1", "chain2", "configerror", "delete", "info",
+ "alltypes", "chain1", "chain2", "chain3", "configerror", "delete", "info",
"internal", "new", "notenoughparams", "twowindows", NULL
};
enum {
- ALL_TYPES, CHAIN1, CHAIN2, CONFIG_ERROR,
+ ALL_TYPES, CHAIN1, CHAIN2, CHAIN3, CONFIG_ERROR,
DEL, /* Can't use DELETE: VC++ compiler barfs. */
INFO, INTERNAL, NEW, NOT_ENOUGH_PARAMS, TWO_WINDOWS
};
@@ -720,7 +720,8 @@ TestobjconfigObjCmd(
break;
}
- case CHAIN2: {
+ case CHAIN2:
+ case CHAIN3: {
ExtensionWidgetRecord *recordPtr;
static const Tk_OptionSpec extensionSpecs[] = {
{TK_OPTION_STRING, "-three", "three", "Three", "three",
@@ -803,6 +804,8 @@ TestobjconfigObjCmd(
}
if (tables[index] != NULL) {
Tk_DeleteOptionTable(tables[index]);
+ /* Make sure that Tk_DeleteOptionTable() is never done
+ * twice for the same table. */
tables[index] = NULL;
}
break;
diff --git a/tests/config.test b/tests/config.test
index a3b4708..a0c1921 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -16,8 +16,8 @@ proc killTables {} {
# chain2 depends on chain1. If chain1 is deleted first, the
# delete of chain2 will crash.
deleteWindows
- foreach t {alltypes chain2 chain1 configerror internal new notenoughparams
- twowindows} {
+ foreach t {alltypes chain3 chain2 chain1 configerror internal
+ new notenoughparams twowindows} {
while {[testobjconfig info $t] != ""} {
testobjconfig delete $t
}
@@ -98,7 +98,7 @@ test config-1.7 {Tk_CreateOptionTable - chained tables} -constraints {
testobjconfig info chain2
} -cleanup {
killTables
-} -result {2 4 -three 2 2 -one}
+} -result {1 4 -three 2 2 -one}
test config-1.8 {Tk_CreateOptionTable - chained tables} -constraints {
testobjconfig
} -body {
@@ -126,15 +126,15 @@ test config-2.1 {Tk_DeleteOptionTable - reference counts} -constraints {
set x {}
testobjconfig chain1 .a
testobjconfig chain2 .b
- testobjconfig chain2 .c
+ testobjconfig chain3 .c
deleteWindows
- testobjconfig delete chain2
+ testobjconfig delete chain3
lappend x [testobjconfig info chain2] [testobjconfig info chain1]
testobjconfig delete chain2
lappend x [testobjconfig info chain2] [testobjconfig info chain1]
} -cleanup {
killTables
-} -result {{} {2 2 -one} {} {2 2 -one}}
+} -result {{3 4 -three 2 2 -one} {2 2 -one} {} {2 2 -one}}
# No tests for DestroyOptionHashTable; couldn't figure out how to test.