From 23bf349214b06cfa4d31e20f48a774fb0f5fb083 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Sat, 23 Jan 2010 22:43:42 +0000 Subject: [PATCH] use autorelease pool when calling bluetooth manager --- configure.in | 2 +- src/bt_control_iphone.m | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index dc2fbc922..7a0258168 100644 --- a/configure.in +++ b/configure.in @@ -95,7 +95,7 @@ if test "x$target" = xiphone; then CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin9/$GCC_VERSION/include" CPPFLAGS="$CPPFLAGS -F$SDK_PATH/System/Library/Frameworks" LDFLAGS="$LDFLAGS -F$SDK_PATH/System/Library/Frameworks" - LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework CoreFoundation -framework UIKit" + LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework Foundation -framework CoreFoundation -framework UIKit" LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A" LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager" LDFLAGS="$LDFLAGS -lIOkit -lobjc" diff --git a/src/bt_control_iphone.m b/src/bt_control_iphone.m index 726e6594c..a3da8de3c 100644 --- a/src/bt_control_iphone.m +++ b/src/bt_control_iphone.m @@ -90,15 +90,21 @@ kern_return_t IOObjectRelease(mach_port_t object); #define kKeyBTNetwork CFSTR("bluetooth-network") int iphone_system_bt_enabled(){ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + if ([[BluetoothManager sharedInstance] enabled]) { return 1; } else { return 0; } + + [pool release]; } void iphone_system_bt_set_enabled(int enabled) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + /* Get a copy of the global bluetooth server */ BluetoothManager *bm = [BluetoothManager sharedInstance]; if ( [bm enabled] && enabled) return; @@ -119,6 +125,8 @@ void iphone_system_bt_set_enabled(int enabled) } /* Synchronize to preferences, e.g. write to disk, bluetooth settings */ CFPreferencesAppSynchronize(kAppNetwork); + + [pool release]; } #endif