may help issue #4714 #4780

This commit is contained in:
rustdesk 2023-06-28 17:09:23 +08:00
parent 9fa9128892
commit bb679bf25a
2 changed files with 15 additions and 13 deletions

View File

@ -205,11 +205,13 @@ class _RemotePageState extends State<RemotePage>
}
@override
void dispose() {
Future<void> dispose() async {
debugPrint("REMOTE PAGE dispose ${widget.id}");
if (useTextureRender) {
platformFFI.registerTexture(sessionId, 0);
textureRenderer.closeTexture(_textureKey);
// sleep for a while to avoid the texture is used after it's unregistered.
await Future.delayed(Duration(milliseconds: 100));
await textureRenderer.closeTexture(_textureKey);
}
// ensure we leave this session, this is a double check
bind.sessionEnterOrLeave(sessionId: sessionId, enter: false);
@ -217,17 +219,17 @@ class _RemotePageState extends State<RemotePage>
_ffi.dialogManager.hideMobileActionsOverlay();
_ffi.recordingModel.onClose();
_rawKeyFocusNode.dispose();
_ffi.close();
await _ffi.close();
_timer?.cancel();
_ffi.dialogManager.dismissAll();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
if (!Platform.isLinux) {
Wakelock.disable();
await Wakelock.disable();
}
Get.delete<FFI>(tag: widget.id);
super.dispose();
await Get.delete<FFI>(tag: widget.id);
removeSharedStates(widget.id);
super.dispose();
}
Widget buildBody(BuildContext context) {

View File

@ -75,19 +75,19 @@ class _RemotePageState extends State<RemotePage> {
}
@override
void dispose() {
Future<void> dispose() async {
gFFI.dialogManager.hideMobileActionsOverlay();
gFFI.inputModel.listenToMouse(false);
gFFI.invokeMethod("enable_soft_keyboard", true);
await gFFI.invokeMethod("enable_soft_keyboard", true);
_mobileFocusNode.dispose();
_physicalFocusNode.dispose();
gFFI.close();
await gFFI.close();
_timer?.cancel();
gFFI.dialogManager.dismissAll();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Wakelock.disable();
keyboardSubscription.cancel();
await Wakelock.disable();
await keyboardSubscription.cancel();
removeSharedStates(widget.id);
super.dispose();
}