packet_list_get_widest_column_string() can return NULL, so check for this.
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 24 Nov 2009 00:16:26 +0000 (00:16 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 24 Nov 2009 00:16:26 +0000 (00:16 +0000)
Use get_default_col_size() to get pixel size for string.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31062 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/new_packet_list.c

index 024854938e20c61b9ebe824d0d7810c5d191ce8d..2e83aa2f5c131cae4fcf5c1f20964ad49c57bc8e 100644 (file)
@@ -316,20 +316,17 @@ new_packet_list_recreate_visible_rows(void)
 
 void new_packet_list_resize_column(gint col)
 {
 
 void new_packet_list_resize_column(gint col)
 {
-       PangoLayout *layout;
        GtkTreeViewColumn *column;
        gint col_width;
        const gchar *long_str;
 
        long_str = packet_list_get_widest_column_string(packetlist, col);
        GtkTreeViewColumn *column;
        gint col_width;
        const gchar *long_str;
 
        long_str = packet_list_get_widest_column_string(packetlist, col);
-       if(strcmp("",long_str)==0)
-               /* If we get an empty string levae the width unchanged */
+       if(!long_str || strcmp("",long_str)==0)
+               /* If we get an empty string leave the width unchanged */
                return;
        column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col);
                return;
        column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col);
-       layout = gtk_widget_create_pango_layout(packetlist->view, long_str );
-       pango_layout_get_pixel_size(layout, &col_width, NULL);
+       col_width = get_default_col_size (packetlist->view, long_str);
        gtk_tree_view_column_set_fixed_width(column, col_width);
        gtk_tree_view_column_set_fixed_width(column, col_width);
-       g_object_unref(G_OBJECT(layout));
 }
 
 static void
 }
 
 static void