From d19d4aacdbba337561e920f5fd6fdab8da909446 Mon Sep 17 00:00:00 2001 From: fufesou Date: Thu, 9 Mar 2023 19:38:47 +0800 Subject: [PATCH 1/3] avoid invalid texture width and height Signed-off-by: fufesou --- flutter/lib/models/model.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 802a18a52..a8ed56bc5 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -371,7 +371,11 @@ class FfiModel with ChangeNotifier { _updateSessionWidthHeight(String id) { parent.target?.canvasModel.updateViewStyle(); - bind.sessionSetSize(id: id, width: display.width, height: display.height); + if (display.width < 0 || display.height < 0) { + debugPrintStack(label: 'invalid display size (${display.width},${display.height})'); + } else { + bind.sessionSetSize(id: id, width: display.width, height: display.height); + } } /// Handle the peer info event based on [evt]. From b042643dfb2c6c9e1b3913caa8c19ef227825bc2 Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 10 Mar 2023 10:16:36 +0800 Subject: [PATCH 2/3] trivial changes Signed-off-by: fufesou --- src/ui_cm_interface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs index f5c575d43..bd6eab3bf 100644 --- a/src/ui_cm_interface.rs +++ b/src/ui_cm_interface.rs @@ -848,7 +848,7 @@ pub fn elevate_portable(_id: i32) { #[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))] #[inline] pub fn handle_incoming_voice_call(id: i32, accept: bool) { - if let Some(client) = CLIENTS.write().unwrap().get_mut(&id) { + if let Some(client) = CLIENTS.read().unwrap().get(&id) { allow_err!(client.tx.send(Data::VoiceCallResponse(accept))); }; } @@ -856,7 +856,7 @@ pub fn handle_incoming_voice_call(id: i32, accept: bool) { #[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))] #[inline] pub fn close_voice_call(id: i32) { - if let Some(client) = CLIENTS.write().unwrap().get_mut(&id) { + if let Some(client) = CLIENTS.read().unwrap().get(&id) { allow_err!(client.tx.send(Data::CloseVoiceCall("".to_owned()))); }; } From 8a09abbf719588f54a5814a4652a81ba8ba54590 Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 10 Mar 2023 10:53:41 +0800 Subject: [PATCH 3/3] avoid w/h <= 0 Signed-off-by: fufesou --- flutter/lib/models/model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index a8ed56bc5..8f46fdca8 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -371,7 +371,7 @@ class FfiModel with ChangeNotifier { _updateSessionWidthHeight(String id) { parent.target?.canvasModel.updateViewStyle(); - if (display.width < 0 || display.height < 0) { + if (display.width <= 0 || display.height <= 0) { debugPrintStack(label: 'invalid display size (${display.width},${display.height})'); } else { bind.sessionSetSize(id: id, width: display.width, height: display.height);