diff --git a/macos/Classes/TextureRgbaApi.m b/macos/Classes/TextureRgbaApi.m index 3b4fd37..6dc2812 100644 --- a/macos/Classes/TextureRgbaApi.m +++ b/macos/Classes/TextureRgbaApi.m @@ -4,6 +4,9 @@ // // Created by kingtous on 2023/2/19. // +// Modified by the Kitedesk fork (2026, T-4204): an autorelease pool around +// each frame. +// #import #import "texture_rgba_renderer/texture_rgba_renderer-Swift.h" @@ -14,8 +17,12 @@ extern "C" { /// Keep the same name with Windows. void FlutterRgbaRendererPluginOnRgba(void* texture_rgba_ptr, const uint8_t* buffer, int len, int width, int height, int stride_align) { - TextRgba* texture_rgba = (__bridge TextRgba *)(texture_rgba_ptr); - [texture_rgba markFrameAvaliableRawWithBuffer:buffer len:len width:width height:height stride_align: stride_align]; + // The caller's thread, a session's video thread, has no autorelease pool and + // lives as long as the session. + @autoreleasepool { + TextRgba* texture_rgba = (__bridge TextRgba *)(texture_rgba_ptr); + [texture_rgba markFrameAvaliableRawWithBuffer:buffer len:len width:width height:height stride_align: stride_align]; + } } #if __cplusplus