diff --git a/gtk/packet_history.c b/gtk/packet_history.c index 6a6b1917b5..7594bf4760 100644 --- a/gtk/packet_history.c +++ b/gtk/packet_history.c @@ -93,6 +93,11 @@ static void clear_list(GList *current) { /* add an entry to the history list */ void packet_history_add(gint row) { + if(row < 1) { + /* Not a valid row number */ + return; + } + if(ignore_jump) { /* we jumping back and forward in history, so don't change list */ return; @@ -142,7 +147,7 @@ static void packet_history_back(void) { /* goto that packet but don't change history */ ignore_jump = TRUE; - cf_goto_frame(&cfile, GPOINTER_TO_INT(previous->data) +1); + cf_goto_frame(&cfile, GPOINTER_TO_INT(previous->data)); ignore_jump = FALSE; } } @@ -163,7 +168,7 @@ static void packet_history_forward(void) { /* goto that packet but don't change history */ ignore_jump = TRUE; - cf_goto_frame(&cfile, GPOINTER_TO_INT(next->data) +1); + cf_goto_frame(&cfile, GPOINTER_TO_INT(next->data)); ignore_jump = FALSE; } } diff --git a/gtk/packet_list.c b/gtk/packet_list.c index 8ee1ad8996..0164c027fe 100644 --- a/gtk/packet_list.c +++ b/gtk/packet_list.c @@ -274,14 +274,20 @@ packet_list_click_column_cb(EthCList *clist, gint column, gpointer data) /* What to do when a list item is selected/unselected */ static void packet_list_select_cb(GtkWidget *w _U_, gint row, gint col _U_, gpointer evt _U_) { + frame_data *fdata; -/* Remove the hex display tabbed pages */ + /* Remove the hex display tabbed pages */ while( (gtk_notebook_get_nth_page( GTK_NOTEBOOK(byte_nb_ptr), 0))) gtk_notebook_remove_page( GTK_NOTEBOOK(byte_nb_ptr), 0); cf_select_packet(&cfile, row); gtk_widget_grab_focus(packet_list); - packet_history_add(row); + + /* Lookup the frame number that corresponds to the list row number */ + fdata = (frame_data *)packet_list_get_row_data(row); + if (fdata != NULL) { + packet_history_add(fdata->num); + } } static void