Got rid of some of the autorelease pool warnings by creating a temporary pool for each call to toNSString().
This commit is contained in:
parent
c7e9c59d63
commit
70d7f9fb2a
|
@ -30,9 +30,17 @@
|
||||||
// because the only way to make a new NSControl/NSView is with a frame (it gets overridden later)
|
// because the only way to make a new NSControl/NSView is with a frame (it gets overridden later)
|
||||||
NSRect dummyRect;
|
NSRect dummyRect;
|
||||||
|
|
||||||
|
// this can be called before our NSApp is created, so keep a pool
|
||||||
id toNSString(char *str)
|
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)
|
char *fromNSString(id str)
|
||||||
|
|
Loading…
Reference in New Issue