GNU bug report logs - #7690
23.2; lwlib-Xm.c

Previous Next

Package: emacs;

Reported by: <weme24 <at> gmx.net>

Date: Mon, 20 Dec 2010 20:15:03 UTC

Severity: serious

Found in version 23.2

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: <weme24 <at> gmx.net>
To: 7690 <at> debbugs.gnu.org
Subject: bug#7690: 23.2; lwlib-Xm.c
Date: Mon, 20 Dec 2010 20:41:19 +0100
While using ispell-buffer my Emacs crashed. After examining the
core-dump I found the following:

in lwlib/lwlib-Xm.c
when val->contens=0
------------------------------------------------------------
static void
xm_update_menu (widget_instance* instance,
                Widget widget,
                widget_value* val,
                Boolean deep_p)
{
  Widget* children;
  unsigned int num_children;
  int num_children_to_keep = 0;
  int i;
  widget_value* cur;

  children = XtCompositeChildren (widget, &num_children);

  /* Widget is a RowColumn widget whose contents have to be updated
   * to reflect the list of items in val->contents */

  /* See how many buttons we can keep, and how many we
     must completely replace.  */
  if (val->contents == 0)
    num_children_to_keep = 0;
  else if (val->contents->change == STRUCTURAL_CHANGE)
    {
      if (children)
	{
	  for (i = 0, cur = val->contents;
               (i < num_children
		&& cur); /* how else to ditch unwanted children ?? - mgd */
	       i++, cur = cur->next)
	    {
	      if (cur->this_one_change == STRUCTURAL_CHANGE)
		break;
	    }

	  num_children_to_keep = i;
	}
    }
  else
    num_children_to_keep = num_children;

  /* Update all the buttons of the RowColumn, in order,
     except for those we are going to replace entirely.  */
  if (children)
    {
      for (i = 0, cur = val->contents; i < num_children_to_keep; i++)
	{
	  if (!cur)
	    {
	      num_children_to_keep = i;
	      break;
	    }
	  if (children [i]->core.being_destroyed
	      || strcmp (XtName (children [i]), cur->name))
	    continue;
	  update_one_menu_entry (instance, children [i], cur, deep_p);
	  cur = cur->next;
	}
    }

  /* Now replace from scratch all the buttons after the last
     place that the top-level structure changed.  */
  if (val->contents->change == STRUCTURAL_CHANGE)       <-- CRASH !!!!
    {
      destroy_all_children (widget, num_children_to_keep);
      make_menu_in_widget (instance, widget, val->contents,
                           num_children_to_keep);
    }

  XtFree ((char *) children);
}
------------------------------------------------------------

So I wrote a quick workaround:

------------------------------------------------------------

--- emacs-23.2/lwlib/lwlib-Xm.c.org     2010-12-16 22:45:47.000000000 +0100
+++ emacs-23.2/lwlib/lwlib-Xm.c 2010-12-16 22:47:11.000000000 +0100
@@ -825,7 +825,7 @@
 
   /* Now replace from scratch all the buttons after the last
      place that the top-level structure changed.  */
-  if (val->contents->change == STRUCTURAL_CHANGE)
+  if (val->contents && val->contents->change == STRUCTURAL_CHANGE)
     {
       destroy_all_children (widget, num_children_to_keep);
       make_menu_in_widget (instance, widget, val->contents,

------------------------------------------------------------

That fixed the problem for me






This bug report was last modified 14 years and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.