Merge "Delete local references to avoid reference table overflow." into kraken
This commit is contained in:
committed by
Android (Google) Code Review
commit
f8acea6ccb
@@ -256,10 +256,12 @@ DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env) {
|
|||||||
parse_property_change(env, msg, (Properties *)&sink_properties,
|
parse_property_change(env, msg, (Properties *)&sink_properties,
|
||||||
sizeof(sink_properties) / sizeof(Properties));
|
sizeof(sink_properties) / sizeof(Properties));
|
||||||
const char *c_path = dbus_message_get_path(msg);
|
const char *c_path = dbus_message_get_path(msg);
|
||||||
|
jstring path = env->NewStringUTF(c_path);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onSinkPropertyChanged,
|
method_onSinkPropertyChanged,
|
||||||
env->NewStringUTF(c_path),
|
path,
|
||||||
str_array);
|
str_array);
|
||||||
|
env->DeleteLocalRef(path);
|
||||||
result = DBUS_HANDLER_RESULT_HANDLED;
|
result = DBUS_HANDLER_RESULT_HANDLED;
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
@@ -292,10 +294,13 @@ void onConnectSinkResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
result = JNI_FALSE;
|
result = JNI_FALSE;
|
||||||
}
|
}
|
||||||
LOGV("... Device Path = %s, result = %d", path, result);
|
LOGV("... Device Path = %s, result = %d", path, result);
|
||||||
|
|
||||||
|
jstring jPath = env->NewStringUTF(path);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onConnectSinkResult,
|
method_onConnectSinkResult,
|
||||||
env->NewStringUTF(path),
|
jPath,
|
||||||
result);
|
result);
|
||||||
|
env->DeleteLocalRef(jPath);
|
||||||
free(user);
|
free(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1061,6 +1061,8 @@ void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
DBusError err;
|
DBusError err;
|
||||||
dbus_error_init(&err);
|
dbus_error_init(&err);
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
|
jstring addr;
|
||||||
|
|
||||||
nat->vm->GetEnv((void**)&env, nat->envVer);
|
nat->vm->GetEnv((void**)&env, nat->envVer);
|
||||||
|
|
||||||
LOGV("... address = %s", address);
|
LOGV("... address = %s", address);
|
||||||
@@ -1109,10 +1111,12 @@ void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addr = env->NewStringUTF(address);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onCreatePairedDeviceResult,
|
method_onCreatePairedDeviceResult,
|
||||||
env->NewStringUTF(address),
|
addr,
|
||||||
result);
|
result);
|
||||||
|
env->DeleteLocalRef(addr);
|
||||||
done:
|
done:
|
||||||
dbus_error_free(&err);
|
dbus_error_free(&err);
|
||||||
free(user);
|
free(user);
|
||||||
@@ -1139,10 +1143,12 @@ void onCreateDeviceResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
}
|
}
|
||||||
LOG_AND_FREE_DBUS_ERROR(&err);
|
LOG_AND_FREE_DBUS_ERROR(&err);
|
||||||
}
|
}
|
||||||
|
jstring addr = env->NewStringUTF(address);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onCreateDeviceResult,
|
method_onCreateDeviceResult,
|
||||||
env->NewStringUTF(address),
|
addr,
|
||||||
result);
|
result);
|
||||||
|
env->DeleteLocalRef(addr);
|
||||||
free(user);
|
free(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1163,10 +1169,12 @@ void onDiscoverServicesResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
LOG_AND_FREE_DBUS_ERROR(&err);
|
LOG_AND_FREE_DBUS_ERROR(&err);
|
||||||
result = JNI_FALSE;
|
result = JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
jstring jPath = env->NewStringUTF(path);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onDiscoverServicesResult,
|
method_onDiscoverServicesResult,
|
||||||
env->NewStringUTF(path),
|
jPath,
|
||||||
result);
|
result);
|
||||||
|
env->DeleteLocalRef(jPath);
|
||||||
free(user);
|
free(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1194,10 +1202,12 @@ void onGetDeviceServiceChannelResult(DBusMessage *msg, void *user, void *n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
jstring addr = env->NewStringUTF(address);
|
||||||
env->CallVoidMethod(nat->me,
|
env->CallVoidMethod(nat->me,
|
||||||
method_onGetDeviceServiceChannelResult,
|
method_onGetDeviceServiceChannelResult,
|
||||||
env->NewStringUTF(address),
|
addr,
|
||||||
channel);
|
channel);
|
||||||
|
env->DeleteLocalRef(addr);
|
||||||
free(user);
|
free(user);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user