社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

+5 投票
We upgraded from 2019.2.2 to 2019.2.5 and now we crash in "FAkComponentCallbackManager::AkComponentCallback" because

"HandleAction" is sometimes called on packages that have been deleted.

 

"FAkComponentCallbackManager::UnregisterGameObject" is called first and deletes the package.

Later on, "FAkComponentCallbackManager::AkComponentCallback" is called for the deleted package and calls "HandleAction" on it.

 

In order to fix the issue, we check "pPackageSet" before checking "pPackage->uUserFlags" and calling "pPackage->HandleAction".

Not sure if there is any side effects.
分类:General Discussion | 用户: Filipe F. (190 分)
标签修改 用户:Filipe F.

2 个回答

0 投票
 
已采纳
Fix is quite easy. You need to first check if pPackageSet for in_pCallbackInfo->gameObjID is not nullptr and if pPackage is inside the pPackageSet then you can HandleAction.
用户: Karel B. (610 分)
采纳于 用户:Filipe F.
Hi Karel, thanks for this. Could you please provide instructions on how to apply this fix?
+5 投票
I don't know if it is correct but it won't crash anymore. 我不知道是否正确,但至少不崩溃了。

if ((pPackage->uUserFlags & in_eType) != 0)

{

    PackageSet* pPackageSet = Instance->GameObjectToPackagesMap.Find(gameObjID);

    if (pPackageSet && (*pPackageSet).Contains(pPackage))

    {

        pPackage->HandleAction(in_eType, in_pCallbackInfo);

    }

}
用户: sun x. (240 分)
From what i have seen from the code, i think in order to access GameObjectToPackagesMap you have to lock "Instance->CriticalSection".
Also i am not confortable with checking "pPackage->uUserFlags" when "pPackage" has been deleted.

I created the post mainly to warn others of the issue.

This is the fix i am using since the first post :

auto pPackage = (IAkUserEventCallbackPackage*)in_pCallbackInfo->pCookie;

if (Instance && pPackage)
{
    const auto& gameObjID = in_pCallbackInfo->gameObjID;
    bool deletePackage = false;
//  begin edit
    bool allowHandleAction = true;
//  end edit
    {
    FScopeLock Lock(&Instance->CriticalSection);
    auto pPackageSet = Instance->GameObjectToPackagesMap.Find(gameObjID);
//  begin edit
    allowHandleAction = (pPackageSet != nullptr);
//  end edit
    if (pPackageSet && in_eType == AK_EndOfEvent)
    {
        Instance->RemovePackageFromSet(pPackageSet, pPackage, gameObjID);
        deletePackage = true;
    }
}

if (in_eType == AK_EndOfEvent)
{
    if (auto* Device = FAkAudioDevice::Get())
    {
        Device->RemovePlayingID(((AkEventCallbackInfo*)in_pCallbackInfo)->eventID, ((AkEventCallbackInfo*)in_pCallbackInfo)->playingID);
                Device->CleanPinnedObjects(((AkEventCallbackInfo*)in_pCallbackInfo)->playingID);
    }
}
//  begin edit
if (allowHandleAction && ((pPackage->uUserFlags & in_eType) != 0))
{
    pPackage->HandleAction(in_eType, in_pCallbackInfo);
}
//  end edit
I was having crashes (mostly on Android) from this issue but these fixes have worked for me so far.
was just getting ready to submit a bug-report including our fix that is pretty much exactly what Filipe did. I agree, this seems the correct way to handle it. The only question I have is that it's an indirect way to test whether the package is deleted. Is there any way the package can exist but not be in the GameObjectToPackagesMap?? For example, can there be a sound running with a callback that's not associated with a game object?  I don't think so, but if that can happen, it's going to miss its callback.
...