diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2009-11-02 04:52:40 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2009-11-02 04:52:40 (GMT) |
commit | bcb6809211c95e27294400f9efa67ccf4dd0ac56 (patch) | |
tree | 5955579ea4d3c7d80eda0ff841a46c2912de46f2 /win/tkWinButton.c | |
parent | ffa34bf2804cda3f87c6a7519e7f6e1a0ef288aa (diff) | |
download | tk-bcb6809211c95e27294400f9efa67ccf4dd0ac56.zip tk-bcb6809211c95e27294400f9efa67ccf4dd0ac56.tar.gz tk-bcb6809211c95e27294400f9efa67ccf4dd0ac56.tar.bz2 |
Fix for [Bug 1739613]
Diffstat (limited to 'win/tkWinButton.c')
-rw-r--r-- | win/tkWinButton.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 22142c7..706f2cc 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.34.2.1 2009/10/05 15:08:07 patthoyts Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.34.2.2 2009/11/02 04:52:40 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); } /* |