[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GC garbles menu items
From: |
Juri Linkov |
Subject: |
Re: GC garbles menu items |
Date: |
Tue, 20 Dec 2005 23:54:07 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
> I can reproduce this bug only on non-toolkit builds.
>
> Aha, now I see. The non-toolkit definition of xmenu_show copies the
> addresses of string text directly into the non-toolkit menu data.
> When GC happens, it relocates the strings and garbles the text.
Is it possible to prevent relocation of the strings in GC for the time
while the menu is up?
> Could you rewrite that code to copy the strings when making the menus,
> and free the copies at the end?
I think it's safer not to change memory allocation code in non-toolkit
XMenu now just before the release. 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):
#ifdef C_ALLOCA
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);
#else
/* if alloca is fast, use that to make the space,
to reduce gc needs. */
item_data
= (unsigned char *) alloca (maxwidth
+ SBYTES (descrip) + 1);
bcopy (SDATA (item_name), item_data,
SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' ';
bcopy (SDATA (descrip), item_data + j,
SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0;
#endif
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: tooltip can be displayed outside the screen, (continued)
- Re: tooltip can be displayed outside the screen, Juri Linkov, 2005/12/05
- Re: tooltip can be displayed outside the screen, Jan D., 2005/12/12
- Re: tooltip can be displayed outside the screen, Juri Linkov, 2005/12/14
- Re: tooltip can be displayed outside the screen, Jan Djärv, 2005/12/14
- Re: tooltip can be displayed outside the screen, Juri Linkov, 2005/12/15
- Re: tooltip can be displayed outside the screen, Richard M. Stallman, 2005/12/15
- Re: tooltip can be displayed outside the screen, Juri Linkov, 2005/12/16
- Re: tooltip can be displayed outside the screen, Richard M. Stallman, 2005/12/16
- GC garbles menu items (was: tooltip can be displayed outside the screen), Juri Linkov, 2005/12/17
- Re: GC garbles menu items (was: tooltip can be displayed outside the screen), Richard M. Stallman, 2005/12/17
- Re: GC garbles menu items,
Juri Linkov <=
- Re: GC garbles menu items, Richard M. Stallman, 2005/12/22
- Re: GC garbles menu items, Juri Linkov, 2005/12/22