JavaScript Event Callbacks Result in Handle = 0 Error

Hi, I’ve been encountering an issue with the HTML5 EventDescription and EventInstance callbacks in fmodstudio js 2.1.07. Whenever I set the callback of an EventDescription and then attempt to create an instance, it will throw an ambiguous error that says that a handle was destroyed and the handle = 0.

Also if I’ve set a callback with an EventInstance directly, and I attempt to release it, I will get the same error unless I set the callback to null right before releasing. Is this a bug, or is there something about JS/Emscripten I am unaware of to use it correctly?

I’ve also set Callbacks to deferred in the Studio System initialization, and the event description/instance callbacks are being set to a function in the global scope.

Thank you for your help,

Aaron

I’ve investigated this and it looks like the callback wrapper for JS<->C side of things is not handling event descriptions properly. Have you tried just event instances by themselves?

The music callback example in the HTML5 studio examples are just using the eventinstance handles for callbacks.

I am looking at fixing support for eventdescriptions but just shifting to instances is a workaround.

Thank you for your time investigating and confirming this. I’ll put a note in the wrapper to let users know to use eventinstances directly.

Eventinstance callbacks set directly are working, but I was encountering the same error when releasing the instance unless I had set the callback to null before releasing. I’m not 100% sure this was the issue so I’ll try to isolate the eventinstance case and get back to you.

Thanks again.

I have fixed this issue for a future release.

1 Like