don't free Int32List for childEntities, stackRestore takes care of this
This commit is contained in:
@@ -58,16 +58,17 @@ class FFIAsset extends ThermionAsset {
|
|||||||
Future<List<ThermionEntity>> getChildEntities() async {
|
Future<List<ThermionEntity>> getChildEntities() async {
|
||||||
if (_childEntities == null) {
|
if (_childEntities == null) {
|
||||||
var count = SceneAsset_getChildEntityCount(asset);
|
var count = SceneAsset_getChildEntityCount(asset);
|
||||||
var childEntities = makeInt32List(count);
|
|
||||||
late Pointer stackPtr;
|
late Pointer stackPtr;
|
||||||
if (FILAMENT_WASM) {
|
if (FILAMENT_WASM) {
|
||||||
stackPtr = stackSave();
|
stackPtr = stackSave();
|
||||||
}
|
}
|
||||||
|
var childEntities = makeInt32List(count);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
SceneAsset_getChildEntities(asset, childEntities.address);
|
SceneAsset_getChildEntities(asset, childEntities.address);
|
||||||
}
|
}
|
||||||
_childEntities = Int32List.fromList(childEntities);
|
_childEntities = Int32List.fromList(childEntities);
|
||||||
childEntities.free();
|
|
||||||
if (FILAMENT_WASM) {
|
if (FILAMENT_WASM) {
|
||||||
stackRestore(stackPtr);
|
stackRestore(stackPtr);
|
||||||
}
|
}
|
||||||
@@ -86,7 +87,6 @@ class FFIAsset extends ThermionAsset {
|
|||||||
for (final entity in childEntities) {
|
for (final entity in childEntities) {
|
||||||
var name = await FilamentApp.instance!.getNameForEntity(entity);
|
var name = await FilamentApp.instance!.getNameForEntity(entity);
|
||||||
names.add(name);
|
names.add(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,6 @@ class FFIAsset extends ThermionAsset {
|
|||||||
@override
|
@override
|
||||||
Future<MaterialInstance> getMaterialInstanceAt(
|
Future<MaterialInstance> getMaterialInstanceAt(
|
||||||
{ThermionEntity? entity, int index = 0}) async {
|
{ThermionEntity? entity, int index = 0}) async {
|
||||||
|
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
if (RenderableManager_isRenderable(app.renderableManager, this.entity)) {
|
if (RenderableManager_isRenderable(app.renderableManager, this.entity)) {
|
||||||
entity ??= this.entity;
|
entity ??= this.entity;
|
||||||
|
|||||||
Reference in New Issue
Block a user