From: Yannick Brosseau Date: Fri, 21 Dec 2012 15:07:59 +0000 (-0500) Subject: Fix seek n backward that did not check the end of a trace X-Git-Tag: v1.5-beta1~32 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=993046ef12d5b804119ef2f742cb7fa2f9835218;p=lttv.git Fix seek n backward that did not check the end of a trace --- 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);