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 633915 - gtk_button_box_child_requisition() mishandles size allocations
gtk_button_box_child_requisition() mishandles size allocations
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-11-03 14:37 UTC by Dan Williams
Modified: 2010-11-04 03:01 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Williams 2010-11-03 14:37:47 UTC
The function counts the number of visible children and tries to allocate returned widths and heights based on that count.  But if the # of visible children is 0, the g_new() call return NULL because it was asked to allocate no memory, and callers of gtk_button_box_child_requisition() like gtk_button_box_size_allocate() which try to use the returned allocated arrays crash.

  while (children)
    {
      ...
      if (gtk_widget_get_visible (child))
        {
          nchildren += 1;
          ...
        }
    }

  *widths = g_new (gint, nchildren);
  *heights = g_new (gint, nchildren);

etc, *widths and *heights will be NULL on return which doesn't work so well :(