From 4adb76aaaa1887a3d0fc749df1b311bdd1283830 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:17:13 +0000 Subject: [PATCH 23/38] font (Apple): wrap detection in NSAutoreleasePool on pre-10.9 targets Ported from https://github.com/macos-powerpc/powerpc-ports/blob/main/sysutils/fastfetch/files/0012-Misc-fixes-for-legacy-systems.patch --- src/detection/font/font_apple.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/detection/font/font_apple.m b/src/detection/font/font_apple.m index ba92981c7..ea7aeca74 100644 --- a/src/detection/font/font_apple.m +++ b/src/detection/font/font_apple.m @@ -4,6 +4,16 @@ #import +#include + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 +#define POOLSTART NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#define POOLEND [pool release]; +#else +#define POOLSTART +#define POOLEND +#endif + static void generateString(FFFontResult* font) { if(font->fonts[0].length > 0) @@ -23,6 +33,7 @@ static void generateString(FFFontResult* font) const char* ffDetectFontImpl(FFFontResult* result) { + POOLSTART ffStrbufAppendS(&result->fonts[0], [NSFont systemFontOfSize:12].familyName.UTF8String); ffStrbufAppendS(&result->fonts[1], [NSFont userFontOfSize:12].familyName.UTF8String); #ifdef MAC_OS_X_VERSION_10_15 @@ -32,6 +43,6 @@ const char* ffDetectFontImpl(FFFontResult* result) #endif ffStrbufAppendS(&result->fonts[3], [NSFont userFixedPitchFontOfSize:12].familyName.UTF8String); generateString(result); - + POOLEND return nullptr; } -- 2.43.0