From: <kak...@us...> - 2009-08-09 09:08:20
|
Revision: 11452 http://amsn.svn.sourceforge.net/amsn/?rev=11452&view=rev Author: kakaroto Date: 2009-08-09 09:08:13 +0000 (Sun, 09 Aug 2009) Log Message: ----------- Clean up code.. store the created windows and close them correctly instead of relying on the NSAutoreleasePool to doo it for us... Modified Paths: -------------- trunk/amsn/utils/farsight/src/tcl_farsight.c trunk/amsn/utils/farsight/tcl_farsight.dylib Modified: trunk/amsn/utils/farsight/src/tcl_farsight.c =================================================================== --- trunk/amsn/utils/farsight/src/tcl_farsight.c 2009-08-09 08:14:56 UTC (rev 11451) +++ trunk/amsn/utils/farsight/src/tcl_farsight.c 2009-08-09 09:08:13 UTC (rev 11452) @@ -98,11 +98,8 @@ static int video_components_selected = 0; static FsElementAddedNotifier *fsnotifier = NULL; - #ifdef __APPLE__ - -static NSAutoreleasePool *cocoa_pool = NULL; - +static GList *cocoa_windows = NULL; #endif @@ -150,6 +147,10 @@ static void Close () { +#ifdef __APPLE__ + GList *i = NULL; +#endif + if (participant) { g_object_unref (participant); participant = NULL; @@ -243,11 +244,14 @@ fsnotifier = NULL; #ifdef __APPLE__ - if (cocoa_pool != NULL) { - [cocoa_pool release]; - cocoa_pool = NULL; + for (i = g_list_first(cocoa_windows); i; ) { + NSWindow *win = (NSWindow *) i->data; + i = g_list_next(i); + cocoa_windows = g_list_remove(cocoa_windows, win); + [win close]; } #endif + } @@ -1727,12 +1731,10 @@ unsigned int mask = NSResizableWindowMask | NSTexturedBackgroundWindowMask | NSMiniaturizableWindowMask; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; nsview = (NSView *)g_value_get_pointer(gst_structure_get_value (s, "nsview")); if (nsview) { - if (cocoa_pool == NULL) { - cocoa_pool = [[NSAutoreleasePool alloc] init]; - } rect.origin.x = 100.0; rect.origin.y = 100.0; rect.size.width = 352.0 ; @@ -1750,9 +1752,10 @@ [win setContentView:nsview]; [win makeKeyAndOrderFront:nil]; - [win autorelease]; + cocoa_windows = g_list_append(cocoa_windows, win); } + [pool release]; } #endif } Modified: trunk/amsn/utils/farsight/tcl_farsight.dylib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |