Open alexgrusu opened 2 months ago
Hi @alexgrusu,
The worker is never deleted after it is created. Only the textures that are created for that instance is deleted like the FBO or the Metal texture.
The worker creates an instance with the dll of dylib files for dart ffi, deleting this is unnecessary because removing this would not be beneficial if you have to call it again later.
Hope this answers your question
We do have a scenario where this could happen. For example, we could navigate to a screen, call setup for flutter angle, and perform an internal validation that triggers the navigation to a different context. This last one triggers the dispose call. It could happen to call dispose on the worker before it is assigned. Mainly this is the scenario that triggers what I described above. We have a different solution for this case, but it might happen to others. Feel free to close the issue if you consider this not important.
Hi @alexgrusu,
Thanks for the information. I will keep it open and update this repo at some point to address this issue.
I believe this can occur when we create a texture, the following method doesn't complete in time
and next, we call
deleteTexture
.The flow is something like this
static Future<FlutterAngleTexture> createTexture(AngleOptions options)
final result = await _channel.invokeMethod('createTexture', {"width": width, "height": height,});
deleteTexture
worker.dispose();
createTexture
-> we get the worker.I have in mind a fix and I can raise a PR. Let me know your thoughts and if that's ok.