diff options
-rw-r--r-- | src/event_callback.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/event_callback.c b/src/event_callback.c index b1cdd02..1bf18ec 100644 --- a/src/event_callback.c +++ b/src/event_callback.c @@ -24,16 +24,15 @@ void luaevent_callback(int fd, short event, void* p) { int ret; double newTimeout = -1; assert(cb); - if(!cb->base) { - /* Callback has been collected... die */ - /* TODO: What should really be done here... */ - return; - } + if(!cb->base) + return; /* Event has already been collected + destroyed */ assert(cb->base->loop_L); L = cb->base->loop_L; lua_rawgeti(L, LUA_REGISTRYINDEX, cb->callbackRef); lua_pushinteger(L, event); lua_call(L, 1, 2); + if(!cb->base) + return; /* event was destroyed during callback */ ret = lua_tointeger(L, -2); if(lua_isnumber(L, -1)) { newTimeout = lua_tonumber(L, -1); |