summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-02-05 11:11:51 (GMT)
committerhobbs <hobbs>2000-02-05 11:11:51 (GMT)
commitc1f87215c2cad528ea7a4a7617b71a78fa22e077 (patch)
tree85776f594803726c4bad9a0e6cf4c1bbf931e544 /unix
parent89c9f372d31b5e61756564807e468a9c3e1fa372 (diff)
downloadtk-c1f87215c2cad528ea7a4a7617b71a78fa22e077.zip
tk-c1f87215c2cad528ea7a4a7617b71a78fa22e077.tar.gz
tk-c1f87215c2cad528ea7a4a7617b71a78fa22e077.tar.bz2
* unix/tkUnixScale.c (TkpDestroyScale): changed ckfree to
Tcl_EventuallyFree to behave with Tcl_Preserve in TkpDisplayScale (prevents possible segfault).
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixScale.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index bafb887..5774cd7 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.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: tkUnixScale.c,v 1.4 1999/12/22 20:01:26 hobbs Exp $
+ * RCS: @(#) $Id: tkUnixScale.c,v 1.5 2000/02/05 11:11:56 hobbs Exp $
*/
#include "tkScale.h"
@@ -56,7 +56,9 @@ TkpCreateScale(tkwin)
*
* TkpDestroyScale --
*
- * Destroy a TkScale structure.
+ * Destroy a TkScale structure. It's necessary to do this with
+ * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work
+ * as expected in TkpDisplayScale. (hobbs)
*
* Results:
* None
@@ -71,7 +73,7 @@ void
TkpDestroyScale(scalePtr)
TkScale *scalePtr;
{
- ckfree((char *) scalePtr);
+ Tcl_EventuallyFree((ClientData) scalePtr, TCL_DYNAMIC);
}
/*
@@ -514,19 +516,18 @@ TkpDisplayScale(clientData)
*/
Tcl_Preserve((ClientData) scalePtr);
- Tcl_Preserve((ClientData) interp);
if ((scalePtr->flags & INVOKE_COMMAND)
&& (scalePtr->commandPtr != NULL)) {
+ Tcl_Preserve((ClientData) interp);
sprintf(string, scalePtr->format, scalePtr->value);
-
result = Tcl_VarEval(interp, Tcl_GetString(scalePtr->commandPtr),
" ", string, (char *) NULL);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
Tcl_BackgroundError(interp);
}
+ Tcl_Release((ClientData) interp);
}
- Tcl_Release((ClientData) interp);
scalePtr->flags &= ~INVOKE_COMMAND;
if (scalePtr->flags & SCALE_DELETED) {
Tcl_Release((ClientData) scalePtr);