use void callback for setBackgroundImage to correctly free pointer after dispatch

This commit is contained in:
Nick Fisher
2024-04-20 13:46:10 +08:00
parent 49229f8c88
commit 15882891e2
4 changed files with 12 additions and 6 deletions

View File

@@ -531,8 +531,10 @@ class FilamentControllerFFI extends FilamentController {
throw Exception("No viewer available, ignoring");
}
final pathPtr = path.toNativeUtf8().cast<Char>();
await _withVoidCallback((cb) {
set_background_image_ffi(_viewer!, pathPtr, fillHeight, cb);
});
set_background_image_ffi(_viewer!, pathPtr, fillHeight);
allocator.free(pathPtr);
}