An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
attempt to fix local reference table overflow, https://github.com/rustdesk/rustdesk/issues/4118
rustdeskce1dac3b8613
diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.ktindex 08bc651c4..dcfb4f4e1 100644--- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt+++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt@@ -64,9 +64,9 @@ class MainService : Service() {@Keep@RequiresApi(Build.VERSION_CODES.N)- fun rustPointerInput(kind: String, mask: Int, x: Int, y: Int) {+ fun rustPointerInput(kind: Int, mask: Int, x: Int, y: Int) {// turn on screen with LIFT_DOWN when screen off- if (!powerManager.isInteractive && (kind == "touch" || mask == LIFT_DOWN)) {+ if (!powerManager.isInteractive && (kind == 0 || mask == LIFT_DOWN)) {if (wakeLock.isHeld) {Log.d(logTag, "Turn on Screen, WakeLock release")wakeLock.release()@@ -75,10 +75,10 @@ class MainService : Service() {wakeLock.acquire(5000)} else {when (kind) {- "touch" -> {+ 0 -> { // touchInputService.ctx?.onTouchInput(mask, x, y)}- "mouse" -> {+ 1 -> { // mouseInputService.ctx?.onMouseInput(mask, x, y)}else -> {diff --git a/libs/scrap/src/android/ffi.rs b/libs/scrap/src/android/ffi.rsindex ca90b5986..5dc6d3b4b 100644--- a/libs/scrap/src/android/ffi.rs+++ b/libs/scrap/src/android/ffi.rs@@ -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),