From 328e924abfea5c6b0c952b9443f18c3df8c68dc5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 11 Oct 2023 15:10:46 +0000 Subject: Fix [9675dd5916]: tkOldConfig.c incorrectly uses ckfree() when freeProc == free. Also eliminate FreeWidget() in ttkWidget.c --- generic/tkOldConfig.c | 4 ++-- generic/ttk/ttkWidget.c | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index fe27ef6..08c95f2 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -716,7 +716,7 @@ FormatConfigInfo( } result = Tcl_Merge(5, argv); if (freeProc != NULL) { - if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { + if (freeProc == TCL_DYNAMIC) { ckfree((char *) argv[4]); } else { freeProc((char *) argv[4]); @@ -939,7 +939,7 @@ Tk_ConfigureValue( &freeProc); Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); if (freeProc != NULL) { - if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { + if (freeProc == TCL_DYNAMIC) { ckfree((char *) result); } else { freeProc((char *) result); diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 9fa8ec0..75ca39c 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -201,15 +201,6 @@ WidgetInstanceObjCmdDeleted(ClientData clientData) Tk_DestroyWindow(corePtr->tkwin); } -/* FreeWidget -- - * Final cleanup for widget; called via Tcl_EventuallyFree(). - */ -static void -FreeWidget(void *memPtr) -{ - ckfree(memPtr); -} - /* DestroyWidget -- * Main widget destructor; called from event handler. */ @@ -238,7 +229,7 @@ DestroyWidget(WidgetCore *corePtr) /* NB: this can reenter the interpreter via a command traces */ Tcl_DeleteCommandFromToken(corePtr->interp, cmd); } - Tcl_EventuallyFree(corePtr, (Tcl_FreeProc *) FreeWidget); + Tcl_EventuallyFree(corePtr, TCL_DYNAMIC); } /* -- cgit v0.12