B252: keep closed textures valid until the engine is done with them
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>
This commit is contained in:
parent
8cd34a80ff
commit
f38b9420ac
15 changed files with 1388 additions and 31 deletions
3
windows/test/shim/VersionHelpers.h
Normal file
3
windows/test/shim/VersionHelpers.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// Kitedesk fork, 2026: test-only stand-in for <VersionHelpers.h> (windows/test).
|
||||
// The plugin includes it but uses nothing from it. Licensed under the Apache
|
||||
// License, Version 2.0, like the rest of this package.
|
||||
63
windows/test/shim/flutter_windows.h
Normal file
63
windows/test/shim/flutter_windows.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// Kitedesk fork, 2026: test-only stand-in for flutter_windows.h of the Flutter
|
||||
// Windows engine (a18df97c) with the declarations that the client wrapper's
|
||||
// plugin_registrar_windows.h and flutter_view.h use; windows/test defines them.
|
||||
// Licensed under the Apache License, Version 2.0, like the rest of this
|
||||
// package.
|
||||
|
||||
#ifndef KD_TEST_SHIM_FLUTTER_WINDOWS_H_
|
||||
#define KD_TEST_SHIM_FLUTTER_WINDOWS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "flutter_export.h"
|
||||
#include "flutter_messenger.h"
|
||||
#include "flutter_plugin_registrar.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct IDXGIAdapter;
|
||||
|
||||
struct FlutterDesktopView;
|
||||
typedef struct FlutterDesktopView* FlutterDesktopViewRef;
|
||||
|
||||
typedef int64_t FlutterDesktopViewId;
|
||||
|
||||
typedef bool (*FlutterDesktopWindowProcCallback)(HWND /* hwnd */,
|
||||
UINT /* uMsg */,
|
||||
WPARAM /*wParam*/,
|
||||
LPARAM /* lParam*/,
|
||||
void* /* user data */,
|
||||
LRESULT* result);
|
||||
|
||||
FLUTTER_EXPORT HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view);
|
||||
|
||||
FLUTTER_EXPORT struct IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter(
|
||||
FlutterDesktopViewRef view);
|
||||
|
||||
FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
|
||||
FlutterDesktopPluginRegistrarRef registrar);
|
||||
|
||||
FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopViewId view_id);
|
||||
|
||||
FLUTTER_EXPORT void
|
||||
FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate,
|
||||
void* user_data);
|
||||
|
||||
FLUTTER_EXPORT void
|
||||
FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // KD_TEST_SHIM_FLUTTER_WINDOWS_H_
|
||||
17
windows/test/shim/windows.h
Normal file
17
windows/test/shim/windows.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Kitedesk fork, 2026: test-only stand-in for <windows.h>, so that the plugin
|
||||
// and the engine's C++ client wrapper build on Linux for windows/test. It has
|
||||
// only the types those headers use. Licensed under the Apache License,
|
||||
// Version 2.0, like the rest of this package.
|
||||
|
||||
#ifndef KD_TEST_SHIM_WINDOWS_H_
|
||||
#define KD_TEST_SHIM_WINDOWS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct HWND__* HWND;
|
||||
typedef unsigned int UINT;
|
||||
typedef uintptr_t WPARAM;
|
||||
typedef intptr_t LPARAM;
|
||||
typedef intptr_t LRESULT;
|
||||
|
||||
#endif // KD_TEST_SHIM_WINDOWS_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue