summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2002-10-08 19:57:48 (GMT)
committerhobbs <hobbs@noemail.net>2002-10-08 19:57:48 (GMT)
commitfcdb8a0a8169831d44e5cbb2342bfd20efd8789b (patch)
tree301b1e3aaafdcf26c12caa11017247b17e2144ed /generic
parentc4b038df592e8a9ae3756a71862437ca9829d62e (diff)
downloadtk-fcdb8a0a8169831d44e5cbb2342bfd20efd8789b.zip
tk-fcdb8a0a8169831d44e5cbb2342bfd20efd8789b.tar.gz
tk-fcdb8a0a8169831d44e5cbb2342bfd20efd8789b.tar.bz2
* generic/tkPanedWindow.c (Tk_PanedWindowObjCmd): leave the
DestroyPanedWindow proc to free the pwPtr, add a Preserve reference to the pwPtr->tkwin. (DestroyPanedWindow): Release the pwPtr->tkwin. FossilOrigin-Name: 140fd8e07525b8d0d20f2f01251a52651a4d4208
Diffstat (limited to 'generic')
-rw-r--r--generic/tkPanedWindow.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index c419847..efc4793 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPanedWindow.c,v 1.9 2002/09/30 18:55:57 hobbs Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.10 2002/10/08 19:57:48 hobbs Exp $
*/
#include "tkPort.h"
@@ -389,10 +389,16 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
pwPtr->cursor = None;
pwPtr->sashCursor = None;
+ /*
+ * Keep a hold of the associated tkwin until we destroy the widget,
+ * otherwise Tk might free it while we still need it.
+ */
+
+ Tcl_Preserve((ClientData) pwPtr->tkwin);
+
if (Tk_InitOptions(interp, (char *) pwPtr, pwOpts->pwOptions,
tkwin) != TCL_OK) {
Tk_DestroyWindow(pwPtr->tkwin);
- ckfree((char *) pwPtr);
return TCL_ERROR;
}
@@ -416,11 +422,10 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
pwPtr->proxywin = Tk_CreateAnonymousWindow(interp, parent, (char *) NULL);
Tk_CreateEventHandler(pwPtr->proxywin, ExposureMask, ProxyWindowEventProc,
(ClientData) pwPtr);
-
+
if (ConfigurePanedWindow(interp, pwPtr, objc - 2, objv + 2) != TCL_OK) {
Tk_DestroyWindow(pwPtr->proxywin);
Tk_DestroyWindow(pwPtr->tkwin);
- ckfree((char *) pwPtr);
return TCL_ERROR;
}
@@ -1466,18 +1471,19 @@ DestroyPanedWindow(pwPtr)
if (pwPtr->slaves) {
ckfree((char *) pwPtr->slaves);
}
-
+
/*
* Remove the widget command from the interpreter.
*/
Tcl_DeleteCommandFromToken(pwPtr->interp, pwPtr->widgetCmd);
-
+
/*
* Let Tk_FreeConfigOptions clean up the rest.
*/
-
+
Tk_FreeConfigOptions((char *) pwPtr, pwPtr->optionTable, pwPtr->tkwin);
+ Tcl_Release((ClientData) pwPtr->tkwin);
pwPtr->tkwin = NULL;
Tcl_EventuallyFree((ClientData) pwPtr, TCL_DYNAMIC);