From 993046ef12d5b804119ef2f742cb7fa2f9835218 Mon Sep 17 00:00:00 2001 From: Yannick Brosseau Date: Fri, 21 Dec 2012 10:07:59 -0500 Subject: [PATCH] Fix seek n backward that did not check the end of a trace --- lttv/lttv/traceset-process.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lttv/lttv/traceset-process.c b/lttv/lttv/traceset-process.c index a41edc2a..dc45b17d 100644 --- a/lttv/lttv/traceset-process.c +++ b/lttv/lttv/traceset-process.c @@ -276,10 +276,20 @@ guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts, count = 0; do { if((ret = lttv_traceset_position_compare(currentPos,initialPos)) == 1){ - bt_iter_next(bt_ctf_get_iter(ts->iter)); - lttv_traceset_destroy_position(currentPos); - currentPos = lttv_traceset_create_current_position(ts); - count++; + if(bt_iter_next(bt_ctf_get_iter(ts->iter)) == 0) { + if(bt_ctf_iter_read_event(ts->iter) != NULL) { + lttv_traceset_destroy_position(currentPos); + currentPos = lttv_traceset_create_current_position(ts); + count++; + } else { + break; + } + + } else { + + //No more event available + break; + } } }while(ret != 0); -- 2.39.5