Merge pull request #2629 from ousttrue/fix/fastspringbone_dispose_reentrant

[SpringBone] dispose function can now be executed again
This commit is contained in:
ousttrue 2025-04-10 14:14:22 +09:00 committed by GitHub
commit 16bf71741f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View File

@ -118,9 +118,9 @@ namespace UniGLTF.SpringBoneJobs
public void Dispose()
{
if (_combinedBuffer is FastSpringBoneCombinedBuffer combined)
if (_combinedBuffer != null)
{
combined.Dispose();
_combinedBuffer.Dispose();
_combinedBuffer = null;
}
}

View File

@ -57,6 +57,8 @@ namespace UniVRM10
{
m_fastSpringBoneService.BufferCombiner.Register(add: null, remove: m_fastSpringBoneBuffer);
m_fastSpringBoneBuffer.Dispose();
// #2616
m_fastSpringBoneBuffer = null;
}
}

View File

@ -54,10 +54,18 @@ namespace UniVRM10
public void Dispose()
{
m_bufferCombiner.Register(add: null, remove: m_fastSpringBoneBuffer);
m_fastSpringBoneBuffer.Dispose();
if (m_fastSpringBoneBuffer != null)
{
m_bufferCombiner.Register(add: null, remove: m_fastSpringBoneBuffer);
m_fastSpringBoneBuffer.Dispose();
// #2616
m_fastSpringBoneBuffer = null;
}
// re-entrant ok
m_fastSpringBoneScheduler.Dispose();
// re-entrant ok
m_bufferCombiner.Dispose();
}