From 38803f0de54b19e89cadf50681675a46f79e5f11 Mon Sep 17 00:00:00 2001 From: fufesou Date: Thu, 27 Oct 2022 12:07:48 +0800 Subject: [PATCH] win_fix_multi_tab: debug done Signed-off-by: fufesou --- flutter/lib/models/model.dart | 9 ++++----- src/ui_cm_interface.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 8e5723588..aa9dfd8e2 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -28,7 +28,7 @@ import 'input_model.dart'; import 'platform_model.dart'; typedef HandleMsgBox = Function(Map evt, String id); -bool _waitForImage = false; +final _waitForImage = {}; class FfiModel with ChangeNotifier { PeerInfo _pi = PeerInfo(); @@ -92,7 +92,6 @@ class FfiModel with ChangeNotifier { clear() { _pi = PeerInfo(); _display = Display(); - _waitForImage = false; _secure = null; _direct = null; _inputBlocked = false; @@ -314,7 +313,7 @@ class FfiModel with ChangeNotifier { parent.target?.dialogManager.showLoading( translate('Connected, waiting for image...'), onCancel: closeConnection); - _waitForImage = true; + _waitForImage[peerId] = true; _reconnects = 1; } } @@ -354,8 +353,8 @@ class ImageModel with ChangeNotifier { ImageModel(this.parent); onRgba(Uint8List rgba) { - if (_waitForImage) { - _waitForImage = false; + if (_waitForImage[id]!) { + _waitForImage[id] = false; parent.target?.dialogManager.dismissAll(); } final pid = parent.target?.id; diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs index 70ea1a15c..c14a4f0c7 100644 --- a/src/ui_cm_interface.rs +++ b/src/ui_cm_interface.rs @@ -56,6 +56,7 @@ struct IpcTaskRunner { cm: ConnectionManager, tx: mpsc::UnboundedSender, rx: mpsc::UnboundedReceiver, + close: bool, conn_id: i32, #[cfg(windows)] file_transfer_enabled: bool, @@ -260,7 +261,6 @@ impl IpcTaskRunner { // for tmp use, without real conn id let mut write_jobs: Vec = Vec::new(); - let mut close = true; #[cfg(windows)] if self.conn_id > 0 { @@ -314,7 +314,7 @@ impl IpcTaskRunner { break; } Data::Disconnected => { - close = false; + self.close = false; #[cfg(windows)] self.enable_cliprdr_file_context(self.conn_id, false).await; log::info!("cm ipc connection disconnect"); @@ -387,6 +387,7 @@ impl IpcTaskRunner { cm, tx, rx, + close: true, conn_id: 0, #[cfg(windows)] file_transfer_enabled: false, @@ -397,7 +398,9 @@ impl IpcTaskRunner { task_runner.run().await; } if task_runner.conn_id > 0 { - task_runner.cm.remove_connection(task_runner.conn_id, close); + task_runner + .cm + .remove_connection(task_runner.conn_id, task_runner.close); } log::debug!("ipc task end"); }