From 3ed639bf6e8ceec216565d2580fb02b26c5e7295 Mon Sep 17 00:00:00 2001 From: jenglish Date: Wed, 17 Feb 2010 20:57:03 +0000 Subject: generic/tkMenu.c: Defer TkMenuOptionTables cleanup to CallWhenDeleted() time, to ensure that the record doesn't get freed until after all widget instance commands have been deleted (Fixes [Bug#2952745]). --- ChangeLog | 7 +++++++ generic/tkMenu.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37542f2..d3beba7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-02-17 Joe English + + * generic/tkMenu.c: Defer TkMenuOptionTables cleanup + to CallWhenDeleted() time, to ensure that the record + doesn't get freed until after all widget instance commands + have been deleted (Fixes [Bug#2952745]). + 2010-01-23 Pat Thoyts * library/bgerror.tcl: [TIP #359]: Extended Window Manager Hints diff --git a/generic/tkMenu.c b/generic/tkMenu.c index b2bbf88..ecba7ba 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.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: tkMenu.c,v 1.20.2.8 2009/02/06 08:14:29 das Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.20.2.9 2010/02/17 20:57:03 jenglish Exp $ */ /* @@ -402,7 +402,8 @@ static Tk_ClassProcs menuClass = { static void FreeOptionTables( - ClientData clientData) + ClientData clientData, + Tcl_Interp *interp) { ckfree(clientData); } @@ -430,8 +431,8 @@ TkCreateMenuCmd(interp) optionTablesPtr->entryOptionTables[CHECK_BUTTON_ENTRY] = Tk_CreateOptionTable(interp, specsArray[CHECK_BUTTON_ENTRY]); - Tcl_CreateObjCommand(interp, "menu", MenuCmd, - (ClientData) optionTablesPtr, FreeOptionTables); + Tcl_CreateObjCommand(interp, "menu", MenuCmd, optionTablesPtr, 0); + Tcl_CallWhenDeleted(interp, FreeOptionTables, optionTablesPtr); if (Tcl_IsSafe(interp)) { Tcl_HideCommand(interp, "menu", "menu"); -- cgit v0.12