mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-05-08 15:18:13 +03:00
@@ -718,6 +718,10 @@ closeConnection({String? id}) {
|
|||||||
final controller = Get.find<DesktopTabController>();
|
final controller = Get.find<DesktopTabController>();
|
||||||
if (controller.tabType == DesktopTabType.terminal &&
|
if (controller.tabType == DesktopTabType.terminal &&
|
||||||
controller.onCloseWindow != null) {
|
controller.onCloseWindow != null) {
|
||||||
|
// Terminal windows are scoped to one peer. The optional id passed to
|
||||||
|
// closeConnection() is that peer id, not a terminal tab key
|
||||||
|
// (${peerId}_${terminalId}). Closing from terminal dialogs should close
|
||||||
|
// the peer's whole terminal window, including all terminal tabs.
|
||||||
unawaited(controller.onCloseWindow!().catchError((e, _) {
|
unawaited(controller.onCloseWindow!().catchError((e, _) {
|
||||||
debugPrint('[closeConnection] Failed to close terminal window: $e');
|
debugPrint('[closeConnection] Failed to close terminal window: $e');
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
|||||||
_windowClosing = true;
|
_windowClosing = true;
|
||||||
final tabKeys = tabController.state.value.tabs.map((t) => t.key).toList();
|
final tabKeys = tabController.state.value.tabs.map((t) => t.key).toList();
|
||||||
// Remove all UI tabs immediately (same instant behavior as the old tabController.clear())
|
// Remove all UI tabs immediately (same instant behavior as the old tabController.clear())
|
||||||
|
// Keep the cleanup target lookup below synchronous before its first await:
|
||||||
|
// it relies on the current frame still retaining each TerminalPage's FFI/model.
|
||||||
tabController.clear();
|
tabController.clear();
|
||||||
// Run session cleanup in parallel with bounded timeout (closeTerminal() has internal 3s timeout).
|
// Run session cleanup in parallel with bounded timeout (closeTerminal() has internal 3s timeout).
|
||||||
// Skip tabs already being closed by a concurrent _closeTab() to avoid duplicate FFI calls.
|
// Skip tabs already being closed by a concurrent _closeTab() to avoid duplicate FFI calls.
|
||||||
|
|||||||
Reference in New Issue
Block a user