diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-07 19:39:59 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-07 19:39:59 -0400 |
| commit | 70d7f9fb2a6098c4807e1beb623536ae70a394e3 (patch) | |
| tree | 3059783e969d0bdb96b1a41831f0843121909036 | |
| parent | c7e9c59d635a60ed555df54d41e479514a638a4c (diff) | |
Got rid of some of the autorelease pool warnings by creating a temporary pool for each call to toNSString().
| -rw-r--r-- | objc_darwin.m | 10 |
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) |
