Undefined reference to 'GDK_WINDOW_XWINDOW'

Bug #916359 reported by Sean Davis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gens3
Confirmed
Critical
Unassigned

Bug Description

While in the process of updating the code to support GTK+ 3.0, I have encountered the following compilation error:

sdllayer/g_sdldraw.c:270: error: undefined reference to 'GDK_WINDOW_XWINDOW'

Full log attached.

Revision history for this message
Sean Davis (bluesabre) wrote :
Changed in gens3:
importance: High → Critical
Revision history for this message
Steven Watson (watson-sm) wrote :

Not sure if this assumption is accurate but from looking at the headers for gdkx.h between versions gtk2 and gtk3 is that GDK_WINDOW_XWINDOW appears to only be defined in gtk2 which would explain why the linker 'ld' is spitting out undefined reference...it hasn't been defined anywhere. It probably got deprecated in the version upgrade. Not sure what the equivalent in gtk3 would be.

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

Got it to compile and link, but seg faults when attempting to run for me.

GDK_WINDOW_XWINDOW(gtk2)
http://developer.gimp.org/api/2.0/gdk/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XWINDOW:CAPS
States another name for

GDK_DRAWABLE_XID()
--------------------------------------
#define GDK_DRAWABLE_XID(win)
Returns the X resource (window or pixmap) belonging to a GdkDrawable.
win :
 a GdkDrawable.
Returns :
 the ID of win's X resource.

which appears to match (gtk3)
gdk_x11_window_get_xid()
http://developer.gnome.org/gdk3/stable/gdk3-X-Window-System-Interaction.html#gdk-x11-window-get-xid

Window gdk_x11_window_get_xid (GdkWindow *window);
----------------------------
Returns the X resource (window) belonging to a GdkWindow.
window :
 a native GdkWindow. [type GdkX11Window]
Returns :
 the ID of drawable's X resource.

Also gtk3
GDK_WINDOW_XID()
---------------------------
#define GDK_WINDOW_XID(win)
Returns the X window belonging to a GdkWindow.
win :
 a GdkWindow.
Returns :
 the Xlib Window of win.

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

The error I get when attempting to run gens is:
(gens:8726): GLib-GObject-CRITICAL **: g_object_set_data_full: assertion `G_IS_OBJECT (object)' failed

(gens:8726): Gtk-CRITICAL **: gtk_widget_get_parent: assertion `GTK_IS_WIDGET (widget)' failed

(gens:8726): GLib-GObject-CRITICAL **: g_object_get_data: assertion `G_IS_OBJECT (object)' failed

(gens:8726): GLib-GObject-CRITICAL **: g_object_get_data: assertion `G_IS_OBJECT (object)' failed

** (gens:8726): WARNING **: Widget not found: vbox1
Segmentation fault

Revision history for this message
Sean Davis (bluesabre) wrote :

After poking around for a bit, it looks like the problem is in the lookup_widget function in /src/gens/gtkui/support.c

But I haven't quite figured out how to fix it yet...

GtkWidget *
lookup_widget (GtkWidget * widget, const gchar * widget_name)
{
 GtkWidget *parent, *found_widget;

 for (;;)
 {
  if (GTK_IS_MENU (widget))
   parent = gtk_menu_get_attach_widget (GTK_MENU
            (widget));
  else
   //parent = widget->parent;
   parent = gtk_widget_get_parent(widget);
  if (!parent)
   parent = g_object_get_data (G_OBJECT (widget),
          "GladeParentKey");
  if (parent == NULL)
   break;
  widget = parent;
 }

 found_widget = (GtkWidget *) g_object_get_data (G_OBJECT (widget),
       widget_name);
 if (!found_widget)
  g_warning ("Widget not found: %s", widget_name);
 return found_widget;
}

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]

Revision history for this message
Sean Davis (bluesabre) wrote :

I think I might tackle this from a slightly different direction. I found a more recent Gens project (Gens/GS) which is significantly cleaned up and the interface files are better separated.

Since Launchpad has been giving me fits (I can no longer upload due to a publickey problem), I have moved over to using mercurial on BitBucket. The project is now hosted here: https://bitbucket.org/seandavis/gens3/

I'm also taking a slightly more stairstepped approach, first upgrading to GTK+ 2.4, finding deprecated items and fixing functions, then stepping up to GTK+ 3.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.