From eb8f9ea50713503c099e22fe5ddfe48cb9b05bb3 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:16:09 +0000 Subject: [PATCH 11/38] bluetooth (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/bluetooth/bluetooth_apple.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/detection/bluetooth/bluetooth_apple.m b/src/detection/bluetooth/bluetooth_apple.m index 22ae236b5..bac744094 100644 --- a/src/detection/bluetooth/bluetooth_apple.m +++ b/src/detection/bluetooth/bluetooth_apple.m @@ -1,6 +1,16 @@ #include "bluetooth.h" -#import +#include + +#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 @interface IOBluetoothDevice() @property (nonatomic) uint8_t batteryPercentCase; @@ -12,6 +22,7 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */) { + POOLSTART NSArray* ioDevices = IOBluetoothDevice.pairedDevices; if(!ioDevices) return "IOBluetoothDevice.pairedDevices failed"; @@ -108,5 +119,6 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF } } + POOLEND return nullptr; } -- 2.43.0