From a7d89a6c247acd8969a15e42f1a236e7b3317f3c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 12 Jun 2008 14:48:24 +0200 Subject: [PATCH] statusbar: fix removal segfault Signed-off-by: Julien Danjou --- statusbar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/statusbar.c b/statusbar.c index 61766437..c81df3cb 100644 --- a/statusbar.c +++ b/statusbar.c @@ -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;