-
Notifications
You must be signed in to change notification settings - Fork 6k
Ensure that unregisterTexture is called when forget to call SurfaceTextureEntry.release #28304
Ensure that unregisterTexture is called when forget to call SurfaceTextureEntry.release #28304
Conversation
…xtureEntry.release
|
/cc @jason-simmons |
|
|
||
| handler.post( | ||
| new Runnable() { | ||
| public void run() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert this Runnable into a static class that does not hold an implicit reference to the SurfaceTextureRegistryEntry.
This will avoid the complexity of resurrecting an object that has already been finalized.
The Runnable will need to hold a reference to the FlutterJNI and the texture ID. If the FlutterJNI is still attached when the Runnable runs on the main thread, then it can call FlutterJNI.unregisterTexture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…urfaceTextureEntry.release (flutter/engine#28304)
…urfaceTextureEntry.release (flutter/engine#28304)
|
|
||
| @Override | ||
| public void run() { | ||
| if (!flutterJNI.isAttached()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this also check if release changed when this code runs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We checked it in the 'finalize' method, and I think the flag cannot be changed when the code runs here.
Fix the issue : flutter/flutter#88571
Pre-launch Checklist
writing and running engine tests.
///).