summaryrefslogtreecommitdiff
path: root/objc_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'objc_darwin.m')
-rw-r--r--objc_darwin.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/objc_darwin.m b/objc_darwin.m
index 918bc7e..5783244 100644
--- a/objc_darwin.m
+++ b/objc_darwin.m
@@ -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)