add free() method for stability on Windows

This commit is contained in:
Nick Fisher
2023-11-07 17:54:57 +11:00
parent e42d5e6263
commit 0748323316
4 changed files with 189 additions and 452 deletions

View File

@@ -163,6 +163,7 @@ FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled)
FLUTTER_PLUGIN_EXPORT void pick(void* const viewer, int x, int y, EntityId* entityId);
FLUTTER_PLUGIN_EXPORT const char* get_name_for_entity(void* const assetManager, const EntityId entityId);
FLUTTER_PLUGIN_EXPORT void ios_dummy();
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void* ptr);
#ifdef __cplusplus
}
#endif

View File

@@ -445,4 +445,11 @@ extern "C"
{
Log("Dummy called");
}
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void* ptr)
{
free(ptr);
}
}

View File

@@ -1015,7 +1015,7 @@ class FilamentControllerFFI extends FilamentController {
var position = modelMatrix.getColumn(3).xyz;
calloc.free(arrayPtr);
flutter_filament_free(arrayPtr.cast<Void>());
return position;
}
@@ -1029,7 +1029,7 @@ class FilamentControllerFFI extends FilamentController {
var modelMatrix = Matrix4.fromFloat64List(doubleList);
var rotationMatrix = Matrix3.identity();
modelMatrix.copyRotation(rotationMatrix);
calloc.free(arrayPtr);
flutter_filament_free(arrayPtr.cast<Void>());
return rotationMatrix;
}

File diff suppressed because it is too large Load Diff