emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC garbles menu items


From: Richard M. Stallman
Subject: Re: GC garbles menu items
Date: Thu, 22 Dec 2005 00:47:39 -0500

    Is it possible to prevent relocation of the strings in GC for the time
    while the menu is up?

There is no feature to stop GC from relocating strings.  Adding one
would be a much more radical and risky change.  I don't want to do
that now, and perhaps not later.

What would be easier to do is turn off GC while the menu is up.  There
is already a way to do that: call inhibit_garbage_collection.  Does this
patch fix it?

*** xmenu.c     21 Dec 2005 19:38:13 -0500      1.297
--- xmenu.c     22 Dec 2005 00:36:37 -0500      
***************
*** 3343,3348 ****
--- 3343,3350 ----
        return Qnil;
      }
  
+   inhibit_garbage_collection ();
+ 
  #ifdef HAVE_X_WINDOWS
    /* Adjust coordinates to relative to the outer (window manager) window.  */
    x += FRAME_OUTER_TO_INNER_DIFF_X (f);

You also wrote:

      I believe it is possible to solve
    this problem by preventing string relocation the same way as it is done
    for menu items where keyboard equivalents are displayed in the same menu
    item.  Such menu items are constructed by the following code in xmenu_show
    (and GC doesn't corrupt these menu items):

What it is doing is copying the strings to the stack.  Indeed, that
technique should work.

Note that the code in the C_ALLOCA case probably has the same kind of
bug that we are discussing, because it creates a Lisp string that
could be moved:

                  Lisp_Object spacer;
                  spacer = Fmake_string (make_number (gap), make_number (' '));
                  item_name = concat2 (item_name, spacer);
                  item_name = concat2 (item_name, descrip);
                  item_data = SDATA (item_name);

It probably doesn't matter, because probably nobody uses the C_ALLOCA
case any more.  I would expect that all those configurations have been
obsolete for years.  Anyway, my patch should fix that too.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]