Comment 6 for bug 916359

Revision history for this message
Steven Watson (watson-sm) wrote :

After examining the program a bit with gdb, the error is coming from a bad pointer.
GtkWidget * gens_window = NULL;
>> Is currently defined globally which is ok I suppose.

in src/gens/emulator/g_main.c on line 856 it is suppose to get set to a new value
gens_window = create_gens_window();
>>create_gens_window() gets called from /src/gens/gtkui/glade/interface.c(or .h if you prefer the headers)
>>the function returns the GtkWidget * window variable
>>however it gets set to NULL by gtk_builder_get_object(builder, "gens_window") function when it should be returning a valid pointer.

So that NULL value get's returned and assigned to gens_window.

which breaks
  g_object_set_data_full(G_OBJECT(gens_window), "sdlsock",
       g_object_ref(sdlsock), (GDestroyNotify) g_object_unref);
because it passes in the NULL value

It also breaks
  gtk_box_pack_end(
       GTK_BOX(lookup_widget(gens_window, "vbox1")),
       sdlsock, 0, 0, 0);

and last but not least
  gtk_widget_show(gens_window);

I haven't been able to figure out why gtk_builder_get_object(builder, "gens_window") in the interface.c file is returning NULL other than the fact it can't find a label called gens_window

gtk_builder_get_object ()
--------------------------
GObject * gtk_builder_get_object (GtkBuilder *builder, const gchar *name);

Gets the object named name. Note that this function does not increment the reference count of the returned object.
builder :
 a GtkBuilder
name :
 name of object to get
Returns :
 the object named name or NULL if it could not be found in the object tree. [transfer none]