statusbar: fix removal segfault

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-12 14:48:24 +02:00
parent 1ac6bf17aa
commit a7d89a6c24
1 changed files with 3 additions and 0 deletions

View File

@ -399,6 +399,7 @@ luaA_statusbar_widget_remove(lua_State *L)
widget_t **widget = luaA_checkudata(L, 2, "widget");
widget_node_t *w;
widget_remove_loop:
for(w = (*sb)->widgets; w; w = w->next)
if(w->widget == *widget)
{
@ -406,6 +407,8 @@ luaA_statusbar_widget_remove(lua_State *L)
widget_node_list_detach(&(*sb)->widgets, w);
p_delete(&w);
(*sb)->need_update = true;
/* need to jump out the loop */
goto widget_remove_loop;
}
return 0;