summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2009-11-02 04:43:26 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2009-11-02 04:43:26 (GMT)
commit2193dc0fe95f1b7b0b072e048b11f73a0844059f (patch)
treeeb664725ea3997496a5315d59c379cffbc0d9cc7
parent7c675582bbdc2db1dc260e3988ba15e6d05c23b6 (diff)
downloadtk-2193dc0fe95f1b7b0b072e048b11f73a0844059f.zip
tk-2193dc0fe95f1b7b0b072e048b11f73a0844059f.tar.gz
tk-2193dc0fe95f1b7b0b072e048b11f73a0844059f.tar.bz2
Fix for [Bug 1739613]
-rw-r--r--ChangeLog7
-rw-r--r--win/tkWinButton.c42
2 files changed, 47 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b84682b..1f91197 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-11-01 Joe Mistachkin <joe@mistachkin.com>
+ * win/tkWinButton.c: [Bug 1739613]: The default width being stored
+ in TSD cannot be put into the process-wide options table. This fix
+ allocates storage for the default width from the heap and frees it
+ using an exit handler.
+
+2009-11-01 Joe Mistachkin <joe@mistachkin.com>
+
* doc/loadTk.n: minor fix for htmlhelp target.
2009-11-01 Joe English <jenglish@users.sourceforge.net>
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 21fc3fb..b3cf7c8 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinButton.c,v 1.37 2009/10/05 14:49:21 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.38 2009/11/02 04:43:26 mistachkin Exp $
*/
#define OEMRESOURCE
@@ -167,6 +167,40 @@ InitBoxes(void)
/*
*----------------------------------------------------------------------
*
+ * ButtonDefaultsExitHandler --
+ *
+ * Frees the defaults for the buttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ButtonDefaultsExitHandler(
+ ClientData clientData) /* Points to an array of option specs,
+ * terminated by one with type
+ * TK_OPTION_END. */
+{
+ Tk_OptionSpec *specPtr = (Tk_OptionSpec *)clientData;
+
+ for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
+ if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
+ if (specPtr->defValue != NULL) {
+ ckfree((char *) specPtr->defValue);
+ specPtr->defValue = NULL;
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpButtonSetDefaults --
*
* This procedure is invoked before option tables are created for
@@ -189,6 +223,7 @@ TkpButtonSetDefaults(
* TK_OPTION_END. */
{
int width;
+ Tk_OptionSpec *savedSpecPtr = specPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -201,9 +236,12 @@ TkpButtonSetDefaults(
}
for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
- specPtr->defValue = tsdPtr->defWidth;
+ char *defValue = (char *) ckalloc(strlen(tsdPtr->defWidth) + 1);
+ strcpy(defValue, tsdPtr->defWidth);
+ specPtr->defValue = defValue;
}
}
+ TkCreateExitHandler(ButtonDefaultsExitHandler, (ClientData) savedSpecPtr);
}
/*