From 3cdd2ef552996044c51109415384ee043e2f2c57 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 20 Aug 2012 14:29:22 -0500 Subject: [PATCH] Don't iterate over the list twice when removing events https://bugzilla.gnome.org/show_bug.cgi?id=679295 --- atk-adaptor/bridge.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index 08dfbd4..96fdbf9 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -575,11 +575,20 @@ remove_events (const char *bus_name, const char *event) spi_event_is_subtype (evdata->data, remove_data)) { GList *events = spi_global_app_data->events; - list = list->next; g_strfreev (evdata->data); g_free (evdata->bus_name); g_free (evdata); - spi_global_app_data->events = g_list_remove (events, evdata); + if (list->prev) + { + GList *next = list->next; + list->prev = g_list_remove (list->prev, evdata); + list = next; + } + else + { + spi_global_app_data->events = g_list_remove (events, evdata); + list = spi_global_app_data->events; + } } else { -- 2.7.4