win_fix_multi_tab: debug done

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-10-27 12:07:48 +08:00
parent db99eccbe0
commit 38803f0de5
2 changed files with 10 additions and 8 deletions

View File

@ -28,7 +28,7 @@ import 'input_model.dart';
import 'platform_model.dart'; import 'platform_model.dart';
typedef HandleMsgBox = Function(Map<String, dynamic> evt, String id); typedef HandleMsgBox = Function(Map<String, dynamic> evt, String id);
bool _waitForImage = false; final _waitForImage = <String, bool>{};
class FfiModel with ChangeNotifier { class FfiModel with ChangeNotifier {
PeerInfo _pi = PeerInfo(); PeerInfo _pi = PeerInfo();
@ -92,7 +92,6 @@ class FfiModel with ChangeNotifier {
clear() { clear() {
_pi = PeerInfo(); _pi = PeerInfo();
_display = Display(); _display = Display();
_waitForImage = false;
_secure = null; _secure = null;
_direct = null; _direct = null;
_inputBlocked = false; _inputBlocked = false;
@ -314,7 +313,7 @@ class FfiModel with ChangeNotifier {
parent.target?.dialogManager.showLoading( parent.target?.dialogManager.showLoading(
translate('Connected, waiting for image...'), translate('Connected, waiting for image...'),
onCancel: closeConnection); onCancel: closeConnection);
_waitForImage = true; _waitForImage[peerId] = true;
_reconnects = 1; _reconnects = 1;
} }
} }
@ -354,8 +353,8 @@ class ImageModel with ChangeNotifier {
ImageModel(this.parent); ImageModel(this.parent);
onRgba(Uint8List rgba) { onRgba(Uint8List rgba) {
if (_waitForImage) { if (_waitForImage[id]!) {
_waitForImage = false; _waitForImage[id] = false;
parent.target?.dialogManager.dismissAll(); parent.target?.dialogManager.dismissAll();
} }
final pid = parent.target?.id; final pid = parent.target?.id;

View File

@ -56,6 +56,7 @@ struct IpcTaskRunner<T: InvokeUiCM> {
cm: ConnectionManager<T>, cm: ConnectionManager<T>,
tx: mpsc::UnboundedSender<Data>, tx: mpsc::UnboundedSender<Data>,
rx: mpsc::UnboundedReceiver<Data>, rx: mpsc::UnboundedReceiver<Data>,
close: bool,
conn_id: i32, conn_id: i32,
#[cfg(windows)] #[cfg(windows)]
file_transfer_enabled: bool, file_transfer_enabled: bool,
@ -260,7 +261,6 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
// for tmp use, without real conn id // for tmp use, without real conn id
let mut write_jobs: Vec<fs::TransferJob> = Vec::new(); let mut write_jobs: Vec<fs::TransferJob> = Vec::new();
let mut close = true;
#[cfg(windows)] #[cfg(windows)]
if self.conn_id > 0 { if self.conn_id > 0 {
@ -314,7 +314,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
break; break;
} }
Data::Disconnected => { Data::Disconnected => {
close = false; self.close = false;
#[cfg(windows)] #[cfg(windows)]
self.enable_cliprdr_file_context(self.conn_id, false).await; self.enable_cliprdr_file_context(self.conn_id, false).await;
log::info!("cm ipc connection disconnect"); log::info!("cm ipc connection disconnect");
@ -387,6 +387,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
cm, cm,
tx, tx,
rx, rx,
close: true,
conn_id: 0, conn_id: 0,
#[cfg(windows)] #[cfg(windows)]
file_transfer_enabled: false, file_transfer_enabled: false,
@ -397,7 +398,9 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
task_runner.run().await; task_runner.run().await;
} }
if task_runner.conn_id > 0 { 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"); log::debug!("ipc task end");
} }