GNOME Bugzilla – Bug 600789
gdk/gdkwindow.c "find_native_sibling_above" will crash
Last modified: 2010-02-23 17:56:14 UTC
GTK+2.19.0 DirectFB 1.4.2 I found that the system will crash in "find_native_sibling_above" gdk/gdkwindow.c traced by gdb, the parameter parent will be NULL. I add the debug message, the output is: (gtk-demo:294): Gdk-WARNING **: find_native_sibling_above_helper: child (gtk-demo:294): Gdk-WARNING **: find_native_sibling_above_helper: for (gtk-demo:294): Gdk-WARNING **: find_native_sibling_above: parent==null the code is: static GdkWindowObject * find_native_sibling_above_helper (GdkWindowObject *parent, GdkWindowObject *child) { GdkWindowObject *w; GList *l; //for debug, 4 lines if (!parent) { g_warning ("find_native_sibling_above_helper: parent==null"); return NULL; } if (child) { //for debug, 1 line g_warning ("find_native_sibling_above_helper: child"); l = g_list_find (parent->children, child); g_assert (l != NULL); /* Better be a child of its parent... */ //for debug, 2 lines if (!l) g_warning ("find_native_sibling_above_helper: l==null"); l = l->prev; /* Start looking at the one above the child */ } else l = g_list_last (parent->children); //for debug, 1 line g_warning ("find_native_sibling_above_helper: for"); for (; l != NULL; l = l->prev) { w = l->data; //for debug, 2 lines if(!w) g_warning ("find_native_sibling_above_helper: w==null"); if (gdk_window_has_impl (w)) return w; g_assert (parent != w); w = find_native_sibling_above_helper (w, NULL); if (w) return w; } return NULL; } static GdkWindowObject * find_native_sibling_above (GdkWindowObject *parent, GdkWindowObject *child) { GdkWindowObject *w; //for debug, 4 lines if (!parent) { g_warning ("find_native_sibling_above: parent==null"); return NULL; } w = find_native_sibling_above_helper (parent, child); if (w) return w; if (gdk_window_has_impl (parent)) return NULL; else return find_native_sibling_above (parent->parent, parent); }
I confirmed this issue, and fixed it. There are two problems: 1. the root window object does not have impl_window so gdk_window_has_impl() always returns false. 2. Each window is not set its parent correctly in _gdk_window_impl_new(). It is set by *not yet set variable*.
Created attachment 149894 [details] [review] A patch
Created attachment 153138 [details] [review] updated patch I have a slightly different patch, as I believe that _gdk_window_update_size() must also be called from _gdk_windowing_window_init(), at least all the other ports do so...