From 1f997eede68e3ffe3fe7ca91b7c516ac4f06b3ea Mon Sep 17 00:00:00 2001 From: das Date: Fri, 6 Feb 2009 08:14:28 +0000 Subject: * generic/tkImgPhoto.c: fix leaks discovered with the Mac OS X * generic/tkMenu.c: Instruments.app Leaks tool. * macosx/tkMacOSXWm.c: --- ChangeLog | 6 ++++++ generic/tkImgPhoto.c | 4 +++- generic/tkMenu.c | 11 +++++++++-- macosx/tkMacOSXWm.c | 8 +++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23ffc1a..e858f82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-06 Daniel Steffen + + * generic/tkImgPhoto.c: fix leaks discovered with the Mac OS X + * generic/tkMenu.c: Instruments.app Leaks tool. + * macosx/tkMacOSXWm.c: + 2009-01-16 Andreas Kupries * win/tkWinWm.c (WmAttributesCmd): Fix a single use of diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 3a2c3c3..bbda26e 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.18 2007/06/23 00:26:42 das Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.19 2009/02/06 08:14:29 das Exp $ */ #include "tkInt.h" @@ -2478,6 +2478,8 @@ ImgPhotoGet(tkwin, masterData) WhitePixelOfScreen(Tk_Screen(tkwin)); gcValues.background = (black != NULL)? black->pixel: BlackPixelOfScreen(Tk_Screen(tkwin)); + Tk_FreeColor(white); + Tk_FreeColor(black); gcValues.graphics_exposures = False; instancePtr->gc = Tk_GetGC(tkwin, GCForeground|GCBackground|GCGraphicsExposures, &gcValues); diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 5936e96..b2bbf88 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.7 2006/05/25 23:51:37 hobbs Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.20.2.8 2009/02/06 08:14:29 das Exp $ */ /* @@ -400,6 +400,13 @@ static Tk_ClassProcs menuClass = { *-------------------------------------------------------------- */ +static void +FreeOptionTables( + ClientData clientData) +{ + ckfree(clientData); +} + int TkCreateMenuCmd(interp) Tcl_Interp *interp; /* Interpreter we are creating the @@ -424,7 +431,7 @@ TkCreateMenuCmd(interp) Tk_CreateOptionTable(interp, specsArray[CHECK_BUTTON_ENTRY]); Tcl_CreateObjCommand(interp, "menu", MenuCmd, - (ClientData) optionTablesPtr, NULL); + (ClientData) optionTablesPtr, FreeOptionTables); if (Tcl_IsSafe(interp)) { Tcl_HideCommand(interp, "menu", "menu"); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index bbc458f..d756713 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.46 2007/12/18 18:21:31 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.47 2009/02/06 08:14:29 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -438,6 +438,9 @@ TkWmDeadWindow( if (wmPtr->hints.flags & IconMaskHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask); } + if (wmPtr->iconName != NULL) { + ckfree(wmPtr->iconName); + } if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } @@ -2982,6 +2985,9 @@ WmTransientCmd( argv3 = Tcl_GetStringFromObj(objv[3], &length); wmPtr->master = Tk_WindowId(master); + if (wmPtr->masterWindowName != NULL) { + ckfree(wmPtr->masterWindowName); + } wmPtr->masterWindowName = ckalloc((unsigned) length+1); strcpy(wmPtr->masterWindowName, argv3); } -- cgit v0.12