Hi Mac developers,

I decided to get rid of the message

2010-12-06 21:32:32.569 FlightGear[26052:903] *** __NSAutoreleaseNoPool(): Object 0x10020a330 of class NSThread autoreleased with no pool in place - just leaking

coming from the Mac flightgear start up GUI. The Net wisdom seems to be that there is a NSAutoreleasePool missing somewhere. Looking into main.m (https://macflightgear.svn.sourceforge.net/svnroot/macflightgear/trunk/FlightGearOSX/main.m) there is a line containing 'detachNewThreadSelector' that causes the problem. I have modified the code to get rid of the message (see attached patch).

However I am confused about the code in main.m. Why is the LauncherThread implemented? In my test set up main.m can be 5 (five) straightforward lines:

--- working main.m ---
#import <RubyCocoa/RBRuntime.h>
int main(int argc, const char *argv[])
{
  return RBApplicationMain("rb_main.rb", argc, argv);
}
------

Is there any need to include LauncherThread? The main.m code is four years old, maybe there was plans to do something that never was finished? Or maybe it is remains from old code? My Objective-C knowledge is very limited so can someone confirm my findings and, if appropriate, update main.m to something like the above or at least to apply the attached patch to remove the annoying message about leaking.


Cheers,

Jari
Index: main.m
===================================================================
--- main.m      (revision 284)
+++ main.m      (arbetskopia)
@@ -23,6 +23,9 @@
 
 int main(int argc, const char *argv[])
 {      
+       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        [NSThread detachNewThreadSelector:@selector(entry:) 
toTarget:[LauncherThread class] withObject:nil];
-    return RBApplicationMain("rb_main.rb", argc, argv);
+       int retval=RBApplicationMain("rb_main.rb", argc, argv);
+       [pool release];
+       return retval;
 }
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to