After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 600789 - gdk/gdkwindow.c "find_native_sibling_above" will crash
gdk/gdkwindow.c "find_native_sibling_above" will crash
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: [obsolete] Backend: directfb
2.19.x
Other Linux
: Normal critical
: ---
Assigned To: Hiroyuki Ikezoe
Michael Emmel
Depends on:
Blocks:
 
 
Reported: 2009-11-05 08:07 UTC by Yan Weichuan
Modified: 2010-02-23 17:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A patch (1.35 KB, patch)
2009-12-17 02:50 UTC, Hiroyuki Ikezoe
none Details | Review
updated patch (5.86 KB, patch)
2010-02-06 15:21 UTC, André Draszik
none Details | Review

Description Yan Weichuan 2009-11-05 08:07:41 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);
}
Comment 1 Hiroyuki Ikezoe 2009-12-17 02:49:44 UTC
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*.
Comment 2 Hiroyuki Ikezoe 2009-12-17 02:50:16 UTC
Created attachment 149894 [details] [review]
A patch
Comment 3 André Draszik 2010-02-06 15:21:14 UTC
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...