Commit graph

8 commits

Author SHA1 Message Date
8cd34a80ff linux: recycle closed textures per engine, closeTexture(recycle:) (Kitedesk B212)
Each session created a new TextureRgba and closeTexture never released it, so
the engine's FlPixelBufferTexture kept its GL texture (one frame of GPU or,
with llvmpipe, process memory per session). Releasing the object is not safe:
FlPixelBufferTexture deletes its GL texture in dispose without selecting a GL
context, so a release from another window deletes that window's texture of
the same name (upstream PR #2 turned the remaining window white).

closeTexture(key, recycle: true) now keeps the texture in a list of the
plugin instance, i.e. of the engine (window) that created it, and the next
createTexture of that engine registers it again. Its GL texture is only ever
touched by that engine's populate in its own context, nothing is released,
and the GL memory is bounded by the number of textures a window had open at
once. When the engine goes away the recycled textures stay referenced for the
same reason. Without recycle (old callers, or a tab that moves to another
window while its session still holds the pointer) a closed texture stays
terminated and is never handed out again.

With no frame waiting, copy_pixels hands out one transparent pixel instead
of no buffer, so a recycled texture cannot show the last frame of its previous
session before the first new frame.

Dart: closeTexture(int key, {bool recycle = false}) sends "recycle"; other
platforms ignore it. Tests: all ten Linux lifecycle tests pass (clang and
gcc, -Wall -Werror, also under ASan/UBSan); Dart 4/4.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 15:38:06 +09:00
Kingtous
937c10ffd9 bump: 0.0.13 2023-03-14 06:07:04 +00:00
Kingtous
f15e5eee20 bump: 0.0.12 2023-03-03 02:16:13 +00:00
Kingtous
44d3a78b9b bump: 0.0.6 2023-02-19 15:36:42 +08:00
Kingtous
4807594245 fix: test file 2023-02-16 16:37:20 +08:00
Kingtous
3d549cb70b opt: hardware accleration texture on Linux 2023-02-16 16:30:11 +08:00
Kingtous
8cb6189a1a refactor: rename 2023-02-16 15:14:21 +08:00
Kingtous
b2bd5910e7 feat: init repo 2023-02-16 15:03:12 +08:00