{
const char *path, *p;
Lisp_Object lpath, element, tem;
+#ifdef NS_SELF_CONTAINED
+ void *autorelease = NULL;
+#endif
/* Default is to use "." for empty path elements.
But if argument EMPTY is true, use nil instead. */
Lisp_Object empty_element = empty ? Qnil : build_string (".");
if (!path)
{
#ifdef NS_SELF_CONTAINED
+ /* ns_relocate needs a valid autorelease pool around it. */
+ autorelease = ns_alloc_autorelease_pool ();
path = ns_relocate (defalt);
#else
path = defalt;
else
break;
}
+
+#ifdef NS_SELF_CONTAINED
+ if (autorelease)
+ ns_release_autorelease_pool (autorelease);
+#endif
return Fnreverse (lpath);
}
ns_appkit_version_str (void)
{
NSString *tmp;
+ Lisp_Object string;
+ NSAutoreleasePool *autorelease;
+ autorelease = [[NSAutoreleasePool alloc] init];
#ifdef NS_IMPL_GNUSTEP
tmp = [NSString stringWithFormat:@"gnustep-gui-%s", Xstr(GNUSTEP_GUI_VERSION)];
#elif defined (NS_IMPL_COCOA)
#else
tmp = [NSString initWithUTF8String:@"ns-unknown"];
#endif
- return [tmp lispString];
+ string = [tmp lispString];
+ [autorelease release];
+
+ return string;
}
void
ns_term_shutdown (int sig)
{
+ NSAutoreleasePool *pool;
+ /* We also need an autorelease pool here, since this can be called
+ during dumping. */
+ pool = [[NSAutoreleasePool alloc] init];
[[NSUserDefaults standardUserDefaults] synchronize];
+ [pool release];
/* code not reached in emacs.c after this is called by shut_down_emacs: */
if (STRINGP (Vauto_save_list_file_name))
unlink (SSDATA (Vauto_save_list_file_name));
if (sig == 0 || sig == SIGTERM)
- {
- [NSApp terminate: NSApp];
- }
- else // force a stack trace to happen
- {
- emacs_abort ();
- }
+ [NSApp terminate: NSApp];
+ else /* Force a stack trace to happen. */
+ emacs_abort ();
}