Skip to content

Commit

Permalink
fix(utils): reorder object disposal to avoid issue with Helper `dispo…
Browse files Browse the repository at this point in the history
…se` methods (#683)
  • Loading branch information
alvarosabu authored May 15, 2024
1 parent 6be07a5 commit e5a2cef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ export function disposeObject3D(object: TresObject): void {
}
else {
const mesh = object as unknown as Partial<Mesh>
if (object) {
object.dispose?.()
}
if (mesh.geometry) {
mesh.geometry.dispose()
delete mesh.geometry
Expand All @@ -308,8 +311,5 @@ export function disposeObject3D(object: TresObject): void {
disposeMaterial(mesh.material)
delete mesh.material
}
if (object) {
object.dispose?.()
}
}
}

0 comments on commit e5a2cef

Please sign in to comment.