Do not unregister texture if move to new window

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-16 21:48:49 +08:00
parent 9ac4346850
commit 1dc96e4fd2
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
super.dispose();
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
bind.sessionEnterOrLeave(sessionId: sessionId, enter: false);
DesktopMultiWindow.removeListener(this);

View File

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