2
0
Fork 0

[core] Enable li_plugins_init_lua again, fixed segfault

personal/stbuehler/wip
Stefan Bühler 2010-06-06 12:29:25 +02:00
parent 14ed0a508b
commit 5e063e2b04
4 changed files with 14 additions and 1 deletions

View File

@ -331,7 +331,9 @@ liHandlerResult li_action_execute(liVRequest *vr) {
break;
case LI_HANDLER_ERROR:
li_action_stack_reset(vr, as);
return res;
case LI_HANDLER_COMEBACK:
return res;
case LI_HANDLER_WAIT_FOR_EVENT:
if (ase != action_stack_top(as)) break; /* allow an action to push another action and rerun after it again */
return res;

View File

@ -298,7 +298,7 @@ void li_lua_init(lua_State *L, liServer *srv, liWorker *wrk) {
li_lua_store_globals(L);
//li_plugins_init_lua(L, srv, wrk);
li_plugins_init_lua(L, srv, wrk);
}
void li_lua_restore_globals(lua_State *L) {

View File

@ -691,6 +691,8 @@ void li_plugins_init_lua(struct lua_State *L, liServer *srv, liWorker *wrk) {
liPlugin *p;
gpointer v;
if (NULL == srv->plugins) return;
g_hash_table_iter_init(&iter, srv->plugins);
while (g_hash_table_iter_next(&iter, NULL, &v)) {
p = (liPlugin*) v;

View File

@ -350,6 +350,11 @@ static gboolean li_server_worker_init(liServer *srv) {
ev_timer_start(loop, &srv->srv_1sec_timer);
ev_unref(loop); /* don't keep loop alive */
#ifdef HAVE_LUA_H
li_plugins_init_lua(srv->L, srv, NULL);
li_plugins_init_lua(srv->main_worker->L, srv, srv->main_worker);
#endif
if (srv->worker_count < 1) srv->worker_count = 1;
g_array_set_size(srv->workers, srv->worker_count);
g_array_index(srv->workers, liWorker*, 0) = srv->main_worker;
@ -361,6 +366,10 @@ static gboolean li_server_worker_init(liServer *srv) {
}
wrk = g_array_index(srv->workers, liWorker*, i) = li_worker_new(srv, loop);
wrk->ndx = i;
#ifdef HAVE_LUA_H
li_plugins_init_lua(wrk->L, srv, wrk);
#endif
}
return TRUE;