Wireshark-dev: Re: [Wireshark-dev] New Wireshark welcome page!

From: "Jim Young" <sysjhy@xxxxxxxxxxxxxxx>
Date: Sat, 19 Apr 2008 12:00:52 -0400
Hello Ulf,

>>> Ulf Lamping <ulf.lamping@xxxxxx> 2008-04-19 10:08 >>>
> Stig Bjï¿œrlykke schrieb:
>> (wireshark:19088): GLib-GObject-CRITICAL **: g_object_get_data:  
>> assertion `G_IS_OBJECT (object)' failed
>
> I just don't see those errors on XP!
> 
> ...and again that lovely little beast called GTK+ ;-)
> 
> Could you step through welcome_new() in gtk/main_welcome.c 
> and tell me where this is happening?

Attached patch (to SVN 25119) stops these particular 
messages during startup of Wireshark on my system.

In my case it's the first call to gtk/main_welcome.c's 
main_welcome_reset_recent_capture_files() that triggers 
the error messages.  Specifically it's the call to 
get_container_get_children(welcome_file_panel_vb).  

This error seems to be triggered because the variable
welcome_file_panel_vb was NULL at this time.   

The attached patch simply tests for a non-NULL 
welcome_file_panel_vb before attempting to get the 
child_list.

Is this the proper fix, or should welcome_file_panel_vb 
have actually had a non-NULL value by the time
main_welcome_reset_recent_capture_files() is first 
called?

Hope this helps.

Jim Y.
Index: gtk/main_welcome.c
===================================================================
--- gtk/main_welcome.c	(revision 25119)
+++ gtk/main_welcome.c	(working copy)
@@ -418,16 +418,18 @@
     GList* child_list_item;
 
 
-    child_box = scroll_box_dynamic_reset(welcome_file_panel_vb);
-    child_list = gtk_container_get_children(GTK_CONTAINER(child_box));
-    child_list_item = child_list;
+    if(welcome_file_panel_vb) {
+        child_box = scroll_box_dynamic_reset(welcome_file_panel_vb);
+        child_list = gtk_container_get_children(GTK_CONTAINER(child_box));
+        child_list_item = child_list;
 
-    while(child_list_item) {
-        gtk_container_remove(GTK_CONTAINER(child_box), child_list_item->data);
-        child_list_item = g_list_next(child_list_item);
+        while(child_list_item) {
+            gtk_container_remove(GTK_CONTAINER(child_box), child_list_item->data);
+            child_list_item = g_list_next(child_list_item);
+        }
+
+        g_list_free(child_list);
     }
-
-    g_list_free(child_list);
 }