mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00:00
fix: linux memory-safe workaround
Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/desktop/pages/file_manager_page.dart';
|
||||
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
||||
import 'package:flutter_hbb/models/model.dart';
|
||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -42,7 +41,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
|
||||
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
||||
print(
|
||||
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
||||
"call ${call.method} with args ${call.arguments} from window ${fromWindowId} to ${windowId()}");
|
||||
// for simplify, just replace connectionId
|
||||
if (call.method == "new_file_transfer") {
|
||||
final args = jsonDecode(call.arguments);
|
||||
@@ -55,21 +54,15 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
unselectedIcon: unselectedIcon,
|
||||
page: FileManagerPage(key: ValueKey(id), id: id)));
|
||||
} else if (call.method == "onDestroy") {
|
||||
tabController.state.value.tabs.forEach((tab) {
|
||||
print("executing onDestroy hook, closing ${tab.label}}");
|
||||
final tag = 'ft_${tab.label}';
|
||||
ffi(tag).close().then((_) {
|
||||
Get.delete<FFI>(tag: tag);
|
||||
});
|
||||
});
|
||||
Get.back();
|
||||
tabController.state.value.tabs.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = isDarkTheme() ? TarBarTheme.dark() : TarBarTheme.light();
|
||||
final theme =
|
||||
isDarkTheme() ? const TarBarTheme.dark() : const TarBarTheme.light();
|
||||
return SubWindowDragToResizeArea(
|
||||
windowId: windowId(),
|
||||
child: Container(
|
||||
@@ -90,9 +83,8 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
}
|
||||
|
||||
void onRemoveId(String id) {
|
||||
ffi("ft_$id").close();
|
||||
if (tabController.state.value.tabs.length == 0) {
|
||||
WindowController.fromWindowId(windowId()).close();
|
||||
if (tabController.state.value.tabs.isEmpty) {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user