gtk: Fix crash on Analyze RTP stream

When updating the RTP streams list, the data associated with the current
selection becomes invalid when the old list is cleared.
gtk_list_store_clear somehow triggers the selection callback which
attempts to access the invalid memory.

Avoid this by disabling selectability while clearing the list.

Bug: 10016
Change-Id: Id5126ec5ffa41fa6a65339f4453546223124ed67
Reviewed-on: https://code.wireshark.org/review/10690
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2015-09-29 22:30:06 +02:00
parent 6ac0d846ec
commit 01bd832b9d
1 changed files with 6 additions and 0 deletions

View File

@ -1087,7 +1087,12 @@ rtpstream_dlg_create (void)
static void
rtpstream_dlg_update(GList *list_lcl)
{
GtkTreeSelection *selection;
if (rtp_stream_dlg != NULL) {
/* Disable selection to avoid rtpstream_view_selection_func from
* triggering and thereby accessing invalid memory. */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE);
gtk_list_store_clear(list_store);
streams_nb = 0;
@ -1098,6 +1103,7 @@ rtpstream_dlg_update(GList *list_lcl)
list_lcl = g_list_next(list_lcl);
}
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
rtpstream_on_unselect(NULL, NULL);
}