Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes

Hello,

I am getting an ambient sound crash on exit, this is on Unreal Engine 4.4.3 with the WWise 4.4 integration.  I would guess this is due to the fact that the object that the callback is trying to operate on is either dereferenced memory or otherwise invalid.  Do you have an intended fix for this issue with 4.5?

This is the code where it crashes:

/*------------------------------------------------------------------------------------
AAkAmbientSound
------------------------------------------------------------------------------------*/
 
/**
 * Static callback for ambient sounds
 */
static void AkAmbientSoundCallback( AkCallbackType in_eType, AkCallbackInfo* in_pCallbackInfo )
{
AAkAmbientSound * pObj = ( (AAkAmbientSound *) in_pCallbackInfo->pCookie );
if( pObj )
{
pObj->Playing( false );
}
}

This is the call stack:  

> ShooterGame-Win64-Shipping.exe!AkAmbientSoundCallback(AkCallbackType in_eType=AK_EndOfEvent, AkCallbackInfo * in_pCallbackInfo=0x000000002351f900) Line 23 C++

  ShooterGame-Win64-Shipping.exe!CAkPlayingMgr::CheckRemovePlayingID(unsigned long in_PlayingID=0, CAkPlayingMgr::PlayingMgrItem * in_pItem=0x0000000020a3a880) Line 166 C++

  ShooterGame-Win64-Shipping.exe!CAkPBI::Term(bool __formal=false) Line 316 C++
  ShooterGame-Win64-Shipping.exe!CAkURenderer::PerformContextNotif() Line 979 C++
  ShooterGame-Win64-Shipping.exe!CAkAudioMgr::Perform() Line 387 C++
  ShooterGame-Win64-Shipping.exe!CAkAudioThread::EventMgrThreadFunc(void * lpParameter=0x0000000000000000) Line 84 C++
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown
 
in General Discussion by Tom W. (180 points)

1 Answer

0 votes
 
Best answer

It seems the AAkAmbientSound has been destroyed before the callback has been called. To safeguard against this, you can change the if( pObj ) to if( pObj && pObj->IsValidLowLevelFast(false) )

This should protect the call to "Playing".
by Benoit S. (Audiokinetic) (16.0k points)
selected by Tom W.
This worked, thanks!
Hey Benoit,

Actually it looks like there are still scenarios where the AkAmbientSoundCallback will crash.  Sometimes the first two checks in IsValidLowLevelFast() will catch the error and sometimes it falls to this third check which then throws an exception on invalid memory access.

// Crashes trying to dereference this, which is invalid memory.
    if (*(void**)this == NULL)
    {
        UE_LOG(LogUObjectBase, Error, TEXT("Virtual functions table is invalid."));
        return false;
    }
...