diff options
author | das <das> | 2009-02-06 08:12:06 (GMT) |
---|---|---|
committer | das <das> | 2009-02-06 08:12:06 (GMT) |
commit | 76e883da5646c90946512d237df48377778d63cc (patch) | |
tree | 575c6e052e7d2d83bbdced2270820a4e834455eb /generic | |
parent | aa3ffc278895964cd47e3ef9e875eee6f8b7e71b (diff) | |
download | tk-76e883da5646c90946512d237df48377778d63cc.zip tk-76e883da5646c90946512d237df48377778d63cc.tar.gz tk-76e883da5646c90946512d237df48377778d63cc.tar.bz2 |
* generic/tkImgPhInstance.c: fix numerous leaks discovered with the
* generic/tkMenu.c: Mac OS X Instruments.app Leaks tool.
* generic/tkText.c:
* generic/tkTextImage.c:
* generic/tkTextIndex.c:
* generic/tkUndo.c:
* generic/tkUtil.c:
* generic/ttk/ttkFrame.c:
* macosx/tkMacOSXWm.c:
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkImgPhInstance.c | 4 | ||||
-rw-r--r-- | generic/tkMenu.c | 12 | ||||
-rw-r--r-- | generic/tkText.c | 3 | ||||
-rw-r--r-- | generic/tkTextImage.c | 5 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 8 | ||||
-rw-r--r-- | generic/tkUndo.c | 10 | ||||
-rw-r--r-- | generic/tkUtil.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkFrame.c | 5 |
8 files changed, 39 insertions, 16 deletions
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 1b0395e..07fa0c0 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhInstance.c,v 1.1 2008/08/25 11:44:04 dkf Exp $ + * RCS: @(#) $Id: tkImgPhInstance.c,v 1.2 2009/02/06 08:12:07 das Exp $ */ #include "tkImgPhoto.h" @@ -350,6 +350,8 @@ TkImgPhotoGet( 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 3d2aa39..fa2959f 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.49 2009/01/14 22:48:10 nijtmans Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.50 2009/02/06 08:12:07 das Exp $ */ /* @@ -393,6 +393,13 @@ static Tk_ClassProcs menuClass = { *-------------------------------------------------------------- */ +static void +FreeOptionTables( + ClientData clientData) +{ + ckfree(clientData); +} + int TkCreateMenuCmd( Tcl_Interp *interp) /* Interpreter we are creating the command @@ -416,7 +423,8 @@ TkCreateMenuCmd( optionTablesPtr->entryOptionTables[CHECK_BUTTON_ENTRY] = Tk_CreateOptionTable(interp, specsArray[CHECK_BUTTON_ENTRY]); - Tcl_CreateObjCommand(interp, "menu", MenuCmd, optionTablesPtr, NULL); + Tcl_CreateObjCommand(interp, "menu", MenuCmd, optionTablesPtr, + FreeOptionTables); if (Tcl_IsSafe(interp)) { Tcl_HideCommand(interp, "menu", "menu"); diff --git a/generic/tkText.c b/generic/tkText.c index c7c5418..4e605ce 100644 --- a/generic/tkText.c +++ b/generic/tkText.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: tkText.c,v 1.88 2009/02/03 23:55:47 nijtmans Exp $ + * RCS: @(#) $Id: tkText.c,v 1.89 2009/02/06 08:12:07 das Exp $ */ #include "default.h" @@ -1968,6 +1968,7 @@ DestroyText( if (sharedTextPtr->bindingTable != NULL) { Tk_DeleteBindingTable(sharedTextPtr->bindingTable); } + ckfree((char *) sharedTextPtr); } if (textPtr->tabArrayPtr != NULL) { diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 6f38943..d0572b0 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.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: tkTextImage.c,v 1.25 2008/10/30 23:18:59 nijtmans Exp $ + * RCS: @(#) $Id: tkTextImage.c,v 1.26 2009/02/06 08:12:07 das Exp $ */ #include "tkPort.h" @@ -472,6 +472,9 @@ EmbImageDeleteProc( Tk_FreeConfigOptions((char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable, NULL); + if (eiPtr->body.ei.name) { + ckfree(eiPtr->body.ei.name); + } ckfree((char *) eiPtr); return 0; } diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 3631cf5..05459cd 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextIndex.c,v 1.34 2008/12/05 15:51:31 nijtmans Exp $ + * RCS: @(#) $Id: tkTextIndex.c,v 1.35 2009/02/06 08:12:07 das Exp $ */ #include "default.h" @@ -113,9 +113,13 @@ DupTextIndexInternalRep( dupIndexPtr->tree = indexPtr->tree; dupIndexPtr->linePtr = indexPtr->linePtr; dupIndexPtr->byteIndex = indexPtr->byteIndex; - + dupIndexPtr->textPtr = indexPtr->textPtr; + if (dupIndexPtr->textPtr != NULL) { + dupIndexPtr->textPtr->refCount++; + } SET_TEXTINDEX(copyPtr, dupIndexPtr); SET_INDEXEPOCH(copyPtr, epoch); + copyPtr->typePtr = &tkTextIndexType; } /* diff --git a/generic/tkUndo.c b/generic/tkUndo.c index ceb6e51..8371f04 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.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: tkUndo.c,v 1.14 2008/11/08 18:44:40 dkf Exp $ + * RCS: @(#) $Id: tkUndo.c,v 1.15 2009/02/06 08:12:07 das Exp $ */ #include "tkInt.h" @@ -131,7 +131,7 @@ TkUndoClearStack( TkUndoSubAtom *sub; sub = elem->apply; - while (sub->next != NULL) { + while (sub != NULL) { TkUndoSubAtom *next = sub->next; if (sub->action != NULL) { @@ -142,7 +142,7 @@ TkUndoClearStack( } sub = elem->revert; - while (sub->next != NULL) { + while (sub != NULL) { TkUndoSubAtom *next = sub->next; if (sub->action != NULL) { @@ -399,7 +399,7 @@ TkUndoSetDepth( prevelem = elem; if (elem->type != TK_UNDO_SEPARATOR) { TkUndoSubAtom *sub = elem->apply; - while (sub->next != NULL) { + while (sub != NULL) { TkUndoSubAtom *next = sub->next; if (sub->action != NULL) { @@ -409,7 +409,7 @@ TkUndoSetDepth( sub = next; } sub = elem->revert; - while (sub->next != NULL) { + while (sub != NULL) { TkUndoSubAtom *next = sub->next; if (sub->action != NULL) { diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 5218740..3c3b5f8 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUtil.c,v 1.27 2008/12/10 05:02:51 das Exp $ + * RCS: @(#) $Id: tkUtil.c,v 1.28 2009/02/06 08:12:07 das Exp $ */ #include "tkInt.h" @@ -1084,7 +1084,7 @@ TkMakeEnsemble( { Tcl_Namespace *namespacePtr = NULL; Tcl_Command ensemble = NULL; - Tcl_Obj *dictObj = NULL; + Tcl_Obj *dictObj = NULL, *nameObj; Tcl_DString ds; int i; @@ -1102,7 +1102,9 @@ TkMakeEnsemble( } } - ensemble = Tcl_FindEnsemble(interp, Tcl_NewStringObj(name,-1), 0); + nameObj = Tcl_NewStringObj(name, -1); + ensemble = Tcl_FindEnsemble(interp, nameObj, 0); + Tcl_DecrRefCount(nameObj); if (ensemble == NULL) { ensemble = Tcl_CreateEnsemble(interp, name, namespacePtr, TCL_ENSEMBLE_PREFIX); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index f7ac834..f7edfe3 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -1,4 +1,4 @@ -/* $Id: ttkFrame.c,v 1.13 2008/11/09 23:53:09 jenglish Exp $ +/* $Id: ttkFrame.c,v 1.14 2009/02/06 08:12:07 das Exp $ * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. @@ -533,6 +533,9 @@ static void LabelframeCleanup(void *recordPtr) { Labelframe *lframe = recordPtr; Ttk_DeleteManager(lframe->label.mgr); + if (lframe->label.labelLayout) { + Ttk_FreeLayout(lframe->label.labelLayout); + } } /* RaiseLabelWidget -- |