fix bug when calling unneeded inside of unneeded callback
This commit is contained in:
@@ -314,6 +314,7 @@ int prosperon_mount_core(void)
|
|||||||
|
|
||||||
void actor_unneeded(cell_rt *actor, JSValue fn, double seconds)
|
void actor_unneeded(cell_rt *actor, JSValue fn, double seconds)
|
||||||
{
|
{
|
||||||
|
if (actor->disrupt) return;
|
||||||
JS_FreeValue(actor->context, actor->unneeded);
|
JS_FreeValue(actor->context, actor->unneeded);
|
||||||
|
|
||||||
if (!JS_IsFunction(actor->context, fn)) {
|
if (!JS_IsFunction(actor->context, fn)) {
|
||||||
@@ -412,6 +413,8 @@ const char *send_message(const char *id, void *msg)
|
|||||||
|
|
||||||
static Uint32 actor_remove_cb(Uint32 id, Uint32 interval, cell_rt *actor)
|
static Uint32 actor_remove_cb(Uint32 id, Uint32 interval, cell_rt *actor)
|
||||||
{
|
{
|
||||||
|
actor->disrupt = 1;
|
||||||
|
|
||||||
if (!JS_IsUndefined(actor->unneeded)) {
|
if (!JS_IsUndefined(actor->unneeded)) {
|
||||||
SDL_LockMutex(actor->mutex);
|
SDL_LockMutex(actor->mutex);
|
||||||
JSValue ret = JS_Call(actor->context, actor->unneeded, JS_UNDEFINED, 0, NULL);
|
JSValue ret = JS_Call(actor->context, actor->unneeded, JS_UNDEFINED, 0, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user