How to prevent UAudioComponent from being "nulled"

IsValid() also does the same thing, the only difference is that it checks for pending kill flag. Even swapping out the nullptr check with IsValid, the crash still occurs (again, not 100% of the time)

But, you may be onto something with auto destroy.

UGameplayStatics::SpawnSound2D has a default parameter of true for auto destroy. So is it possible that Unreal is destroying it in a different thread? It’s the only explanation I can think of bypassing a nullptr check and IsValid() If it was destroying on the same thread, then it would be null already or after the call, not during it.

When I investigate the mini dump in the debugger, the other threads are not doing anything. Specifically the audio thread is waiting at the time of the call. But that also doesn’t mean it didn’t do it prior to handling the destroy or something. Or it could be one of the many other threads doing something Im unfamiliar with.

1 Like