# Pure virtual functio call - removePlayingEvent crash

**URL:** <https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676>\
**Category:** Unity\
**Created:** [April 22, 2020, 12:01pm UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676 "2020-04-22T12:01:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![deathbypixel](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deathbypixel](https://qa.fmod.com/u/deathbypixel)\
**Post date:** [April 22, 2020, 12:01pm UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/1 "2020-04-22T12:01:07Z")

</div>

Hi,

Months later I’m tracking down a rare crash, which still occurs in standalone Unity builds. The crash is “pure virtual function call” and the original old thread is here [Hard crash in Unity - pure virtual function call](https://qa.fmod.com/t/hard-crash-in-unity-pure-virtual-function-call/15324).

I managed to get a crash dump from a build and using the symbols from fmod I now have the following callstack.

```
fmodstudioL.dll!abort() Line 88	C
fmodstudioL.dll!_purecall() Line 57	C

```

> fmodstudioL.dll!FMOD::BusInstance::removePlayingEvent(FMOD::EventInstance \* instance) Line 871 C++  
> fmodstudioL.dll!FMOD::EventInstance::stop(FMOD::EventInstance::StopMode stopMode, bool restarting) Line 290 C++  
> fmodstudioL.dll!FMOD::EventInstance::update(float deltaSeconds) Line 608 C++  
> fmodstudioL.dll!FMOD::EventInstanceContainer::update(float deltaSeconds) Line 182 C++  
> fmodstudioL.dll!FMOD::PlaybackSystem::update(FMOD::TimeStamp \* owningTimestamp, bool alreadyCachedClocks) Line 1034 C++  
> fmodstudioL.dll!FMOD::RuntimeAPI::Manager::update(FMOD::TimeStamp \* owningTimestamp, bool cacheClocks) Line 216 C++  
> [Inline Frame] fmodstudioL.dll!FMOD::AsyncManager::asyncProcessAndUpdate() Line 768 C++  
> fmodstudioL.dll!FMOD::AsyncManager::asyncThreadLoop() Line 802 C++  
> fmodstudioL.dll!FMOD:🧵:callback(void \* data) Line 56 C++  
> fmodstudioL.dll!FMOD\_OS\_Thread\_Callback(void \* param) Line 537 C++  
> fmodstudioL.dll!\_callthreadstartex() Line 354 C  
> fmodstudioL.dll!\_threadstartex(void \* ptd) Line 332 C

unfortunately that is where the trail ends for me as I don’t have access to source. Is there someone who can give some insight into what removePlayingEvent is trying to do? Obviously I’m all on the managed side of code in Unity, but if anyone at FMOD recognizes this callstack or could give me a hit of how this can occur I would be very grateful.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [April 28, 2020, 12:28am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/2 "2020-04-28T00:28:42Z")

</div>

What versions of FMOD and Unity are you using?

---

<div class="post-metadata">

**Author:** ![zy8zzr](https://avatars.discourse-cdn.com/v4/letter/z/edb3f5/32.png) [@zy8zzr](https://qa.fmod.com/u/zy8zzr)\
**Post date:** [April 30, 2020, 7:39am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/3 "2020-04-30T07:39:48Z")

</div>

fmod 2.00.08, unity2018.4.21

---

<div class="post-metadata">

**Author:** ![deathbypixel](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deathbypixel](https://qa.fmod.com/u/deathbypixel)\
**Post date:** [April 30, 2020, 7:52am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/4 "2020-04-30T07:52:31Z")

</div>

We are on Unity 2019.3.3f1, FMOD version 2.00.03

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 4, 2020, 5:16am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/5 "2020-05-04T05:16:21Z")

</div>

Are you able to share your dmp file and any log files you may also have so that we can try to debug it here? You can upload the files to [https://fmod.com/profile#uploads](https://fmod.com/profile#uploads).

---

<div class="post-metadata">

**Author:** ![deathbypixel](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deathbypixel](https://qa.fmod.com/u/deathbypixel)\
**Post date:** [May 4, 2020, 1:01pm UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/6 "2020-05-04T13:01:07Z")

</div>

The dump itself is 13 gigs unfortunately. Is there someone who can contact me directly and I can screen share?

Best

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 5, 2020, 1:19am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/7 "2020-05-05T01:19:07Z")

</div>

That is a large crash dump, are you able to share the log file at all?  
If it is reproduceable and you are able to record a Profiler capture in Studio, we should be able to use that .  
[https://fmod.com/resources/documentation-studio?version=2.1&page=profiling.html#recording-a-new-session](https://fmod.com/resources/documentation-studio?version=2.1&page=profiling.html#recording-a-new-session)

---

<div class="post-metadata">

**Author:** ![deathbypixel](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deathbypixel](https://qa.fmod.com/u/deathbypixel)\
**Post date:** [May 20, 2020, 2:03pm UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/8 "2020-05-20T14:03:18Z")

</div>

unfortunately it is very difficult to reproduce. we suspect it has something to do with an FMOD.Studio.EVENT\_CALLBACK but cannot be certain. Is there someplace we can share some code, that isn’t on the forum? It would be helpful for an engineer to take a look at our event callback code and see if there is something we are doing out of order.

Screen sharing is also an option. The crash is sporadic and unfortunately not rare enough for us to ignore further

---

<div class="post-metadata">

**Author:** ![deathbypixel](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@deathbypixel](https://qa.fmod.com/u/deathbypixel)\
**Post date:** [May 20, 2020, 2:27pm UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/9 "2020-05-20T14:27:37Z")

</div>

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/79ca87659772e6281ab702a1614b23f8055b06e9.png)

Here is what we are doing. We have a class AudioTimelineEventListener. It has a single instance and owner. In turn this class creates one instance of an AudiotTimeLineInfo class, which is marked as sequential. It has a couple of int members only. Now on some game event, we call Init, which sets the timelinehandle as user data on an eventInstance and then sets the callback.

When we no longer want a beat callback on this instance, we call  
eventInstance.setCallback(null);  
eventInstance.setUserData(IntPtr.Zero);

Init can be called several times during a play session, (essentially when we switch music). Before we set user data and callback, any old instance which has been playing has callback set to null and userdata to zero.

Is it safe to keep this AudioTimelineInfo and timelineHandle alive (and pinned) for the entire lifetime of the game but simply assign our callback to new event instances or does this method require us to allocate a new handle whenever we assign a parameter to a new event instance?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 27, 2020, 5:44am UTC](https://qa.fmod.com/t/pure-virtual-functio-call-removeplayingevent-crash/15676/10 "2020-05-27T05:44:40Z")

</div>

What you showed appears to be fine.  
Are you able to get any logging leading up to the crash? Preferably while using the logging level ‘log’.
