static gboolean
_process_filter_event(E_Input_Event_Source *ev_source, E_Input_Event *ev)
{
- GList *l;
+ GList *l, *clone;
E_Input_Event_Filter *ef;
void *data;
g_rec_mutex_lock(&ev_source->ev_filter_mutex);
l = ev_source->ev_filter_list;
- while (l)
+ clone = g_list_copy(l);
+ g_rec_mutex_unlock(&ev_source->ev_filter_mutex);
+
+ for(GList *list = g_list_first(clone); list; list = list->next)
{
- data = l->data;
+ data = list->data;
ef = (E_Input_Event_Filter *)data;
if (ef && ef->event == ev->event_type)
{
{
if (ef->func(ef->user_data, ef->event, ev->ev_data) == FALSE)
{
- g_rec_mutex_unlock(&ev_source->ev_filter_mutex);
+ g_list_free(clone);
+ clone = NULL;
return FALSE;
}
}
}
+ }
- l = g_list_next(l);
+ if (clone)
+ {
+ g_list_free(clone);
+ clone = NULL;
}
- g_rec_mutex_unlock(&ev_source->ev_filter_mutex);
return TRUE;
}
static gboolean
_process_event_handler(E_Input_Event_Source *ev_source, E_Input_Event *ev)
{
- GList *l;
+ GList *l, *clone;
E_Input_Event_Handler *eh = NULL;
void *data;
g_rec_mutex_lock(&ev_source->ev_handler_mutex);
l = ev_source->ev_handler_list;
- while (l)
+ clone = g_list_copy(l);
+ g_rec_mutex_unlock(&ev_source->ev_handler_mutex);
+
+ for(GList *list = g_list_first(clone); list; list = list->next)
{
- data = l->data;
+ data = list->data;
if (!data)
continue;
{
if (eh->func(eh->user_data, eh->event, ev->ev_data) == FALSE)
{
- g_rec_mutex_unlock(&ev_source->ev_handler_mutex);
+ g_list_free(clone);
+ clone = NULL;
return FALSE;
}
}
}
+ }
- l = g_list_next(l);
+ if (clone)
+ {
+ g_list_free(clone);
+ clone = NULL;
}
- g_rec_mutex_unlock(&ev_source->ev_handler_mutex);
return TRUE;
}