summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-06-04 09:46:03 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-06-04 09:46:03 -0700
commitf8acea6ccbdd7e7283b1dc439f49c72a937f746d (patch)
treefd86290ce0abc36a00bcb38f34aa2d739b0edd0b /core
parentcefb01abbfdb175e0c4b298126bcb4a98bf6371f (diff)
parenta7c0bdc4e46301530c89c67ec3ce6ae8df7260d7 (diff)
downloadframeworks_base-f8acea6ccbdd7e7283b1dc439f49c72a937f746d.zip
frameworks_base-f8acea6ccbdd7e7283b1dc439f49c72a937f746d.tar.gz
frameworks_base-f8acea6ccbdd7e7283b1dc439f49c72a937f746d.tar.bz2
Merge "Delete local references to avoid reference table overflow." into kraken
Diffstat (limited to 'core')
-rw-r--r--core/jni/android_server_BluetoothA2dpService.cpp9
-rw-r--r--core/jni/android_server_BluetoothEventLoop.cpp18
2 files changed, 21 insertions, 6 deletions
diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp
index cf53a06..8c795af 100644
--- a/core/jni/android_server_BluetoothA2dpService.cpp
+++ b/core/jni/android_server_BluetoothA2dpService.cpp
@@ -256,10 +256,12 @@ DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env) {
parse_property_change(env, msg, (Properties *)&sink_properties,
sizeof(sink_properties) / sizeof(Properties));
const char *c_path = dbus_message_get_path(msg);
+ jstring path = env->NewStringUTF(c_path);
env->CallVoidMethod(nat->me,
method_onSinkPropertyChanged,
- env->NewStringUTF(c_path),
+ path,
str_array);
+ env->DeleteLocalRef(path);
result = DBUS_HANDLER_RESULT_HANDLED;
return result;
} else {
@@ -292,10 +294,13 @@ void onConnectSinkResult(DBusMessage *msg, void *user, void *n) {
result = JNI_FALSE;
}
LOGV("... Device Path = %s, result = %d", path, result);
+
+ jstring jPath = env->NewStringUTF(path);
env->CallVoidMethod(nat->me,
method_onConnectSinkResult,
- env->NewStringUTF(path),
+ jPath,
result);
+ env->DeleteLocalRef(jPath);
free(user);
}
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index 259cc01..01b6711 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -1061,6 +1061,8 @@ void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) {
DBusError err;
dbus_error_init(&err);
JNIEnv *env;
+ jstring addr;
+
nat->vm->GetEnv((void**)&env, nat->envVer);
LOGV("... address = %s", address);
@@ -1109,10 +1111,12 @@ void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) {
}
}
+ addr = env->NewStringUTF(address);
env->CallVoidMethod(nat->me,
method_onCreatePairedDeviceResult,
- env->NewStringUTF(address),
+ addr,
result);
+ env->DeleteLocalRef(addr);
done:
dbus_error_free(&err);
free(user);
@@ -1139,10 +1143,12 @@ void onCreateDeviceResult(DBusMessage *msg, void *user, void *n) {
}
LOG_AND_FREE_DBUS_ERROR(&err);
}
+ jstring addr = env->NewStringUTF(address);
env->CallVoidMethod(nat->me,
method_onCreateDeviceResult,
- env->NewStringUTF(address),
+ addr,
result);
+ env->DeleteLocalRef(addr);
free(user);
}
@@ -1163,10 +1169,12 @@ void onDiscoverServicesResult(DBusMessage *msg, void *user, void *n) {
LOG_AND_FREE_DBUS_ERROR(&err);
result = JNI_FALSE;
}
+ jstring jPath = env->NewStringUTF(path);
env->CallVoidMethod(nat->me,
method_onDiscoverServicesResult,
- env->NewStringUTF(path),
+ jPath,
result);
+ env->DeleteLocalRef(jPath);
free(user);
}
@@ -1194,10 +1202,12 @@ void onGetDeviceServiceChannelResult(DBusMessage *msg, void *user, void *n) {
}
done:
+ jstring addr = env->NewStringUTF(address);
env->CallVoidMethod(nat->me,
method_onGetDeviceServiceChannelResult,
- env->NewStringUTF(address),
+ addr,
channel);
+ env->DeleteLocalRef(addr);
free(user);
}
#endif