GNOME Bugzilla – Bug 597417
GDL appears broken with GTK 2.18 client side window support
Last modified: 2009-11-24 16:04:03 UTC
Not sure if this is a GDL or GTK bug. I was experimenting with GDL and could not get it function properly. Thinking I wasn't doing anything wrong, I compiled test-dock.c as a standalone app. It was also not working. It appears to be an issue with the client side windows in GTK 2.18. If I use "env GDK_NATIVE_WINDOWS=1" then test-code works correctly. A few errors I was seeing on the console.. gdl-test-dock:2287): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (gdl-test-dock:2287): Gdk-WARNING **: losing last reference to undestroyed window (gdl-test-dock:2287): GLib-GObject-CRITICAL **: g_object_ref: assertion `object->ref_count > 0' failed (gdl-test-dock:2287): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)' failed (gdl-test-dock:2287): Gdk-CRITICAL **: gdk_window_set_user_data: assertion `GDK_IS_WINDOW (window)' failed (gdl-test-dock:2287): Gdk-CRITICAL **: _gdk_window_destroy_hierarchy: assertion `GDK_IS_WINDOW (window)' failed (gdl-test-dock:2287): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (gdl-test-dock:2287): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (gdl-test-dock:2287): Gdk-WARNING **: losing last reference to undestroyed window
Well, I have no gtk 2.18 to test here in the moment but it is of course possible that it breaks with client-side windows. I would just expect gtk+ to be backward-compatible... IIRC there was a property to force a window to be a "real" X-Window.
"env GDK_NATIVE_WINDOWS=1" restores the old behavior. test-code.c does work correctly when this is used. Since you don't have 2.18 at the moment I'll see if I have time to do some further debugging. Thanks.
You are right, something is horribly broken with client-side windows but gdb doesn't give any useful traces. I am really in need of someone knowing more about client-side windows.
Alex, could you give some hints why things might be broken? Gdl does all kind of Gdk low level stuff which probably now fails in some ways.
Unfortunately not being familiar with the internal gdl code leaves me at a disadvantage in terms of being much help. The only thing I did try was a few calls to gdk_window_ensure_native() in the gdl code. This seemed to help workaround the problem. However it did not completely fix it.
Jim, could you still post it here - maybe it's useful.
Created attachment 148369 [details] [review] diff using gdk_window_ensure_native I attached a diff. The only thing it does is call gdk_window_ensure_native() on three different GdkWindow's created with gdk_window_new(). This does appear to help workaround the problem.
From the warnings it seems to me like GDL is unrefing a gdwindow, which it should not (unless it ref:ed it specially before that) as the refs are owned by gdk. This was always an error but will not cause immediate problems for native windows since the xserver side has a ref to the window. For native window however there is no additional ref that will keep the window alive, so if you incorrectly unref the window then things will crash/warn. The correct thing to do is to call gdk_window_destroy() on a window that was allocated with gdk_window_new().
Hmm, i don't see any obvious bogus unrefs...
Created attachment 148383 [details] [review] Fixes the issue It was a bit indirect, gdl_dock_item_grip_unrealize() sets GTK_NO_WINDOW flag and then calls the parent unrealize handler, which will unref widget->window. widget->window is set to grip->title_window which at this time is destroyed. Refing it when setting it fixes the issue.
Thanks a lot for looking into this!