Merge pull request #5413 from dignow/fix/move_tab_to_new_window_unregister_texture

Do not unregister texture if move to new window
This commit is contained in:
RustDesk 2023-08-16 21:54:35 +08:00 committed by GitHub
commit 1ef2ca83a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -204,7 +204,7 @@ class _RemotePageState extends State<RemotePage>
// https://github.com/flutter/flutter/issues/64935 // https://github.com/flutter/flutter/issues/64935
super.dispose(); super.dispose();
debugPrint("REMOTE PAGE dispose session $sessionId ${widget.id}"); debugPrint("REMOTE PAGE dispose session $sessionId ${widget.id}");
await _renderTexture.destroy(); await _renderTexture.destroy(closeSession);
// ensure we leave this session, this is a double check // ensure we leave this session, this is a double check
bind.sessionEnterOrLeave(sessionId: sessionId, enter: false); bind.sessionEnterOrLeave(sessionId: sessionId, enter: false);
DesktopMultiWindow.removeListener(this); DesktopMultiWindow.removeListener(this);

View File

@ -31,9 +31,11 @@ class RenderTexture {
} }
} }
destroy() async { destroy(bool unregisterTexture) async {
if (useTextureRender && _textureKey != -1 && _sessionId != null) { if (useTextureRender && _textureKey != -1 && _sessionId != null) {
if (unregisterTexture) {
platformFFI.registerTexture(_sessionId!, 0); platformFFI.registerTexture(_sessionId!, 0);
}
await textureRenderer.closeTexture(_textureKey); await textureRenderer.closeTexture(_textureKey);
_textureKey = -1; _textureKey = -1;
} }