Windows: closeTexture hands the texture to UnregisterTexture's callback and
frees its frame buffers there; frames pushed after close are dropped. Without
"recycle" the object is kept for the process lifetime (the session may still
hold its pointer); an engine that shuts down keeps its open textures the same
way. A duplicate createTexture key gets -1, getTexturePtr of an unknown key 0.
macOS: closeTexture drops the frame and closes the texture to later frames;
only "recycle" removes it from the plugin.
Linux: the frame handed to the engine last is freed at that engine's next
copy_pixels or once the engine has shut down, not at close: from Flutter 3.32
the raster thread can still be uploading it.
Tests: windows/test/run_tests.sh (plain, --asan, --tsan) and
linux/test/run_tests.sh (plain, --asan).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Standalone C++ tests for the Linux texture, built against the engine of the
active Flutter SDK by linux/test/run_tests.sh (optionally with ASan/UBSan).
The plugin source is compiled into the test and driven through a real
FlMethodChannel on fake engine objects (binary messenger, texture registrar
with the reference rules of engine a18df97c, plugin registrar); frame
buffers copied with new[] are counted.
On 42797e0f eight of the ten tests fail: closing a texture keeps both frame
buffers, the GObject has no finalize, and closed textures are never reused,
so every session leaves a frame buffer and an engine GL texture behind.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>