Closed mmhtx closed 1 year ago
Also, I do cache RuntimeAudioImporter as a UPROPERTY()
per https://github.com/gtreshchev/RuntimeAudioImporter/issues/48
FGCObjectScopeGuard is needed to ensure that the object isn't destroyed as garbage while it's within scope. It's a workaround for developers who might forget about garbage collection in their code. But this scope guard isn't essential and won't affect behavior if both RuntimeAudioImporter and Sound Wave instances are handled properly, considering garbage collection.
I think your issue arises from not adding either the RuntimeAudioImporter or ImportedSoundWave instances to separate UPROPERTYs. This leads to garbage collection destroying those objects while they're still in use. So, ensure the objects have strong references.
Regarding ConditionalBeginDestroy
, ideally, this should be managed by the garbage collection itself. Instead of explicitly destroying the object like you did, it's better to simply nullify it in your UPROPERTY. The object will then become eligible for garbage collection and will be destroyed in the next GC iteration.
Please reopen this ticket if still relevant.
Hello, excellent plugin, I have a crashing bug or I'm doing something wrong.
We are using RuntimeAudioImporter with the UnrealReplay system. Wave files are loaded as a result of time scrubbing. While loading the wave file, there is a chance that the RuntimeAudioImporter crashes, note the callstack below. I'm actually getting several different callstacks, different each time, but it always centers around FGCObject. The below callstack, however, is the most indicative of the problem, note RuntimeAudioImporterLibrary.cpp:114. That code corresponds to an AsyncTask with a FGCObjectScopeGuard Guard(this); in it. If I comment out the FGCObjectScopeGuard Guard(this); then the issue is eliminated on Windows, and reduced on Android.
Is this a bug/limitation in RuntimeAudioImporter, loading wave files in rapid succession, or am I likely doing something wrong?
I'm loading the wave like so
And in HandleRuntimeAudioImporterOnResult I
Also, I don't understand the exact purpose of FGCObjectScopeGuard Guard(this);. I understand that I locks the AsyncTask so that only 1 can execute at a time, but in this case why is it necessary?
Best Regards