I want to use js-binding in my project so I followed the tutorial and wrote the very basic js binding code for a test.
I used the js-binding template for my project so in the code it already had some js registration code for the engine:
i put my js registration code ahead of the existing js registration code:
+sc~~>addRegisterCallback;+ //my js class registration
in this case, I saw my js invoking and callbacks all work, but the problem comes when I close the application and it crashes at ScriptingCore::cleanup():
js_type_class_t* current, *tmp;
HASH_ITER(hh, _js_global_type_ht, current, tmp)
free(current);//this is where it crashes………………
I checked the pointer address and found it crashed when clearing my js type, and deeper in the callstack it crashed at CrtIsValidHeapPointer() function….
I checked my js binding code, I even did comparison with the existing js registration code and couldn’t find the answer to this issuse.
So the js binding code worked but then the ‘type’ address became invalid??
Any thoughts shared would be appreciated