gtk: fix crash when moving columns

When the columns are moved, the packet list is redrawn from the
columns-changed signal handler. Apparently GTK does not like that the
parent contains got destroyed.

Call packet_list_recreate outside the callback to workaround this issue.
Since the signal handler is blocked, it can never be called twice (and
there will always be at most one packet_list_recreate_delayed
scheduled).

Bug: 10795
Change-Id: Ia97d330c8bef747809fa09a8709a19cb03c7e00a
Reviewed-on: https://code.wireshark.org/review/5881
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Peter Wu 2014-12-19 20:28:05 +01:00 committed by Pascal Quantin
parent 553da37446
commit ff01bc6c4e
1 changed files with 9 additions and 1 deletions

View File

@ -599,6 +599,12 @@ packet_list_column_button_pressed_cb (GtkWidget *widget, GdkEvent *event, gpoint
return popup_menu_handler (widget, event, menu);
}
static gboolean packet_list_recreate_delayed(gpointer user_data _U_)
{
packet_list_recreate();
return FALSE;
}
static void
column_dnd_changed_cb(GtkTreeView *tree_view, gpointer data _U_)
{
@ -634,7 +640,9 @@ column_dnd_changed_cb(GtkTreeView *tree_view, gpointer data _U_)
prefs_main_write();
}
packet_list_recreate();
/* The columns widget is part of the packets list, delay destruction to
* avoid triggering a use-after-free (maybe a GTK3 bug?) */
g_idle_add(packet_list_recreate_delayed, NULL);
}
static GtkWidget *