Got rid of some of the autorelease pool warnings by creating a temporary pool for each call to toNSString().

This commit is contained in:
Pietro Gagliardi 2014-06-07 19:39:59 -04:00
parent c7e9c59d63
commit 70d7f9fb2a
1 changed files with 9 additions and 1 deletions

View File

@ -30,9 +30,17 @@
// because the only way to make a new NSControl/NSView is with a frame (it gets overridden later)
NSRect dummyRect;
// this can be called before our NSApp is created, so keep a pool
id toNSString(char *str)
{
return [NSString stringWithUTF8String:str];
NSAutoreleasePool *pool;
NSString *s;
pool = [NSAutoreleasePool new];
s = [NSString stringWithUTF8String:str];
[s retain]; // keep alive after releasing the pool
[pool release];
return s;
}
char *fromNSString(id str)