File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
shell/platform/android/io/flutter/embedding/android Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ public class FlutterTextureView extends TextureView implements RenderSurface {
3838 private boolean isAttachedToFlutterRenderer = false ;
3939 @ Nullable
4040 private FlutterRenderer flutterRenderer ;
41+ @ Nullable
42+ private Surface renderSurface ;
4143
4244 // Connects the {@code SurfaceTexture} beneath this {@code TextureView} with Flutter's native code.
4345 // Callbacks are received by this Object and then those messages are forwarded to our
@@ -172,7 +174,8 @@ private void connectSurfaceToRenderer() {
172174 throw new IllegalStateException ("connectSurfaceToRenderer() should only be called when flutterRenderer and getSurfaceTexture() are non-null." );
173175 }
174176
175- flutterRenderer .startRenderingToSurface (new Surface (getSurfaceTexture ()));
177+ renderSurface = new Surface (getSurfaceTexture ());
178+ flutterRenderer .startRenderingToSurface (renderSurface );
176179 }
177180
178181 // FlutterRenderer must be non-null.
@@ -192,5 +195,7 @@ private void disconnectSurfaceFromRenderer() {
192195 }
193196
194197 flutterRenderer .stopRenderingToSurface ();
198+ renderSurface .release ();
199+ renderSurface = null ;
195200 }
196201}
You can’t perform that action at this time.
0 commit comments