From: Christian B. <cb...@ce...> - 2010-01-02 09:52:23
|
I'm no Objective C or Cocoa master either... :) -------- Original Message -------- Subject: [PATCH] SheepShaver, Mac OS X, and NSAutoreleasePool Date: Fri, 1 Jan 2010 16:07:45 -0500 From: Tim Douglas <ti...@gm...> To: cb...@ce... Mr. Bauer, Thanks so much for the development of SheepShaver. It's wonderful reliving memories of Mac OSs past on my shiny Core 2 MacBook Pro. When compiling the source from CVS and running it on Mac OS X 10.5.8, I receive these messages on stderr: 2010-01-01 16:02:08.421 SheepShaver[11638:10b] *** _NSAutoreleaseNoPool(): Object 0x30d800 of class NSPathStore2 autoreleased with no pool in place - just leaking Stack: (0x92b65f4f 0x92a73637 0x92a7feb7 0x957c7fa3 0x957f2e6d 0x78072372 0x7804a29f 0x78049066) 2010-01-01 16:02:08.423 SheepShaver[11638:10b] *** _NSAutoreleaseNoPool(): Object 0x314490 of class NSCFData autoreleased with no pool in place - just leaking Stack: (0x92b65f4f 0x92a72432 0x92a86b25 0x92a86701 0x957c8280 0x957c8161 0x957c7fdf 0x957f2e6d 0x78072372 0x7804a29f 0x78049066) 2010-01-01 16:02:08.430 SheepShaver[11638:10b] *** _NSAutoreleaseNoPool(): Object 0xa08a0fa0 of class NSCFString autoreleased with no pool in place - just leaking Stack: (0x92b65f4f 0x92a72432 0x957c8161 0x957c7fdf 0x957f2e6d 0x78072372 0x7804a29f 0x78049066) ...and five more similar ones. It appears as if Cocoa APIs are being used without an NSAutoreleasePool in place. The attached CVS diff appears to fix the issue by establishing the appropriate pool before the calls are made. I'm no Objective C or Cocoa master, nor do I have that strong of a grasp of the internal workings of SheepShaver, but presumably something along these lines is all that's needed. Thanks again for the great emulator! -Tim ---------cut here--------- Index: src/MacOSX/prefs_macosx.mm =================================================================== RCS file: /home/cvs/cebix/SheepShaver/src/MacOSX/prefs_macosx.mm,v retrieving revision 1.2 diff -u -r1.2 prefs_macosx.mm --- src/MacOSX/prefs_macosx.mm 18 Aug 2009 18:22:01 -0000 1.2 +++ src/MacOSX/prefs_macosx.mm 1 Jan 2010 20:56:08 -0000 @@ -30,6 +30,7 @@ @interface SheepShaverMain : NSObject NSArray *nibObjects; NSWindow *prefsWindow; + NSAutoreleasePool *pool; @end @implementation SheepShaverMain @@ -97,6 +98,7 @@ NSMenu *appMenu; NSMenuItem *menuItem; + pool = [[NSAutoreleasePool alloc] init]; appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu]; menuItem = [[NSMenuItem alloc] initWithTitle:@"Preferences..." action:@selector(openPreferences:) keyEquivalent:@","]; [appMenu insertItem:menuItem atIndex:2]; @@ -113,4 +115,5 @@ void prefs_exit(void) { + [pool release]; } |