diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-03-21 01:31:02 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-03-21 01:31:02 (GMT) |
commit | 6f271af3157483e82be0a839323490597eac5e04 (patch) | |
tree | 4968b67a528b6d9e86370951dc604bfa36b14ec8 /macosx/tkMacOSXMenu.c | |
parent | 50ec1ecb24801b023618048a6704fa12670671d9 (diff) | |
download | tk-6f271af3157483e82be0a839323490597eac5e04.zip tk-6f271af3157483e82be0a839323490597eac5e04.tar.gz tk-6f271af3157483e82be0a839323490597eac5e04.tar.bz2 |
Improvement of memory management, removal of zombie windows from Tk-Cocoa; thanks to Marc Culler for patch
Diffstat (limited to 'macosx/tkMacOSXMenu.c')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 5ae38f8..49d1872 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -261,6 +261,7 @@ static int ModifierCharWidth(Tk_Font tkfont); /*Add time for errors to fire if necessary. This is sub-optimal but avoids issues with Tcl/Cocoa event loop integration.*/ Tcl_Sleep(100); + NSAutoreleasePool *pool = [NSAutoreleasePool new]; Tcl_Preserve(interp); Tcl_Preserve(menuPtr); @@ -273,6 +274,7 @@ static int ModifierCharWidth(Tk_Font tkfont); } Tcl_Release(menuPtr); Tcl_Release(interp); + [pool drain]; } } } @@ -382,6 +384,13 @@ static int ModifierCharWidth(Tk_Font tkfont); [pool drain]; } +- (void) safeSetMainMenu: (NSMenu *) menu +{ + NSAutoreleasePool* pool = [NSAutoreleasePool new]; + [self setMainMenu: menu]; + [pool drain]; +} + - (void) menuBeginTracking: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS |