mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
attempt to fix local reference table overflow, https://github.com/rustdesk/rustdesk/issues/4118
This commit is contained in:
@@ -209,19 +209,38 @@ pub fn clear_codec_info() {
|
||||
*MEDIA_CODEC_INFOS.write().unwrap() = None;
|
||||
}
|
||||
|
||||
// another way to fix "reference table overflow" error caused by new_string and call_main_service_pointer_input frequently calld
|
||||
// is below, but here I change kind from string to int for performance
|
||||
/*
|
||||
env.with_local_frame(10, || {
|
||||
let kind = env.new_string(kind)?;
|
||||
env.call_method(
|
||||
ctx,
|
||||
"rustPointerInput",
|
||||
"(Ljava/lang/String;III)V",
|
||||
&[
|
||||
JValue::Object(&JObject::from(kind)),
|
||||
JValue::Int(mask),
|
||||
JValue::Int(x),
|
||||
JValue::Int(y),
|
||||
],
|
||||
)?;
|
||||
Ok(JObject::null())
|
||||
})?;
|
||||
*/
|
||||
pub fn call_main_service_pointer_input(kind: &str, mask: i32, x: i32, y: i32) -> JniResult<()> {
|
||||
if let (Some(jvm), Some(ctx)) = (
|
||||
JVM.read().unwrap().as_ref(),
|
||||
MAIN_SERVICE_CTX.read().unwrap().as_ref(),
|
||||
) {
|
||||
let mut env = jvm.attach_current_thread_as_daemon()?;
|
||||
let kind = env.new_string(kind)?;
|
||||
let kind = if kind == "touch" { 0 } else { 1 };
|
||||
env.call_method(
|
||||
ctx,
|
||||
"rustPointerInput",
|
||||
"(Ljava/lang/String;III)V",
|
||||
&[
|
||||
JValue::Object(&JObject::from(kind)),
|
||||
JValue::Int(kind),
|
||||
JValue::Int(mask),
|
||||
JValue::Int(x),
|
||||
JValue::Int(y),
|
||||
|
||||
Reference in New Issue
Block a user