From 553d1e7b0ac6005fcf3d4b47f496ae72c6fc3994 Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 6 Jul 2004 20:50:09 +0000 Subject: [PATCH] request servicing fix git-svn-id: http://ltt.polymtl.ca/svn@623 04897980-b3bd-0310-b5e0-8ef037075253 --- .../gui/lttvwindow/lttvwindow/callbacks.c | 59 ++++++++++++------- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 5 +- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 130f4f1a..ce0c068e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -536,7 +536,6 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) lpos = g_slist_append(lpos, g_slist_nth_data(list_out, 0)); for(iter=g_slist_nth(list_out,1);iter!=NULL;iter=g_slist_next(iter)) { /* Find all position requests with the lowest position in list_out */ - guint index_lpos = g_array_index(lpos, guint, 0); EventsRequest *event_request_lpos = (EventsRequest*)g_slist_nth_data(lpos, 0); EventsRequest *event_request_list_out = (EventsRequest*)iter->data; @@ -560,7 +559,6 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } } - /* 1.1.3 If lpos.start time < ltime */ { EventsRequest *event_request_lpos = (EventsRequest*)g_slist_nth_data(lpos, 0); EventsRequest *event_request_ltime = (EventsRequest*)g_slist_nth_data(ltime, 0); @@ -568,22 +566,24 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) if(event_request_lpos != NULL && event_request_lpos->start_position != NULL) { - lpos_start_time = lttv_traceset_context_position_get_time( event_request_lpos->start_position); - if(ltt_time_compare(lpos_start_time, - event_request_ltime->start_time)<0) { - /* Add lpos to list_in, remove them from list_out */ - - for(iter=lpos;iter!=NULL;iter=g_slist_next(iter)) { - /* Add to list_in */ - EventsRequest *event_request_lpos = - (EventsRequest*)iter->data; - - list_in = g_slist_append(list_in, event_request_lpos); - /* Remove from list_out */ - list_out = g_slist_remove(list_out, event_request_lpos); - } + } + + /* 1.1.3 If lpos.start time < ltime */ + if(event_request_lpos != NULL + && event_request_lpos->start_position != NULL + && ltt_time_compare(lpos_start_time, + event_request_ltime->start_time)<0) { + /* Add lpos to list_in, remove them from list_out */ + for(iter=lpos;iter!=NULL;iter=g_slist_next(iter)) { + /* Add to list_in */ + EventsRequest *event_request_lpos = + (EventsRequest*)iter->data; + + list_in = g_slist_append(list_in, event_request_lpos); + /* Remove from list_out */ + list_out = g_slist_remove(list_out, event_request_lpos); } } else { /* 1.1.4 (lpos.start time >= ltime) */ @@ -690,7 +690,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } } else { /* 2. Else, list_in is not empty, we continue a read */ - + { /* 2.0 For each req of list_in */ GSList *iter = list_in; @@ -713,13 +713,17 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } { - GSList *iter = NULL; tfc = lttv_traceset_context_get_current_tfc(tsc); /* 2.1 For each req of list_out */ - for(iter=list_out;iter!=NULL;iter=g_slist_next(iter)) { - EventsRequest *events_request = (EventsRequest*)iter->data; + GSList *iter = list_out; + + while(iter != NULL) { + gboolean remove = FALSE; + gboolean free_data = FALSE; + EventsRequest *events_request = (EventsRequest *)iter->data; + /* if req.start time == current context time * or req.start position == current position*/ if( ltt_time_compare(events_request->start_time, @@ -732,7 +736,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) ) { /* - Add to list_in, remove from list_out */ list_in = g_slist_append(list_in, events_request); - list_out = g_slist_remove(list_out, events_request); + remove = TRUE; + free_data = FALSE; /* - If !servicing */ if(events_request->servicing == FALSE) { @@ -751,6 +756,18 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) events_request->event, events_request->event_by_id); } + + /* Go to next */ + if(remove) + { + GSList *remove_iter = iter; + + iter = g_slist_next(iter); + if(free_data) g_free(remove_iter->data); + list_out = g_slist_remove_link(list_out, remove_iter); + } else { // not remove + iter = g_slist_next(iter); + } } } } diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index d2009771..3b11176e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -851,8 +851,9 @@ void lttvwindow_events_request(Tab *tab, if(!tab->events_request_pending) { - /* Redraw has +20 priority. We want a prio higher than that, so +19 */ - g_idle_add_full((G_PRIORITY_HIGH_IDLE + 19), + /* Redraw has +20 priority. We want to let the redraw be done while we do + * our job. */ + g_idle_add_full((G_PRIORITY_HIGH_IDLE + 21), (GSourceFunc)execute_events_requests, tab, NULL); -- 2.34.1