From 6f89fdb2a5f10844485f8e93b284b7fff581f50b Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:19:53 +0000 Subject: [PATCH 04/38] osascript (Apple): wrap in NSAutoreleasePool and drop ARC-only literal init Manual reference counting is required without ARC on older toolchains; replace the NSAppleScript literal init with an explicit alloc/init and wrap execution in POOLSTART/POOLEND. Ported from https://github.com/macos-powerpc/powerpc-ports/blob/main/sysutils/fastfetch/files/0012-Misc-fixes-for-legacy-systems.patch --- src/common/apple/osascript.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/common/apple/osascript.m b/src/common/apple/osascript.m index f17af0369..ebe9ae8e1 100644 --- a/src/common/apple/osascript.m +++ b/src/common/apple/osascript.m @@ -1,15 +1,19 @@ #include "osascript.h" -#import +#include +#include +#include -bool ffOsascript(const char* input, FFstrbuf* result) -{ - NSAppleScript* script = [NSAppleScript.alloc initWithSource:@(input)]; +bool ffOsascript(const char* input, FFstrbuf* result) { + POOLSTART + NSString* appleScript = [NSString stringWithUTF8String: input]; + NSAppleScript* script = [[NSAppleScript alloc] initWithSource:appleScript]; NSDictionary* errInfo = nil; NSAppleEventDescriptor* descriptor = [script executeAndReturnError:&errInfo]; if (errInfo) return false; - ffStrbufSetS(result, descriptor.stringValue.UTF8String); + ffStrbufSetS(result, [[descriptor stringValue] cStringUsingEncoding:NSUTF8StringEncoding]); + POOLEND return true; } -- 2.43.0