[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 2c5f215: Avoid crashes in Mew due to corrupted tool-bar label
From: |
Eli Zaretskii |
Subject: |
emacs-27 2c5f215: Avoid crashes in Mew due to corrupted tool-bar label |
Date: |
Sat, 27 Feb 2021 02:28:29 -0500 (EST) |
branch: emacs-27
commit 2c5f21541957e2420e54ab2a70883140811708f7
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid crashes in Mew due to corrupted tool-bar label
* src/gtkutil.c (update_frame_tool_bar): Don't keep around a
'char *' pointer to a Lisp string's contents when calling Lisp,
because that could relocate string data; keep the Lisp string
itself instead. This avoids crashes in Mew. (Bug#46791)
---
src/gtkutil.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d824601..825fbe1 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -5019,11 +5019,10 @@ update_frame_tool_bar (struct frame *f)
GtkWidget *wbutton = NULL;
Lisp_Object specified_file;
bool vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
- const char *label
- = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL
- : STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
- ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL))
- : "";
+ Lisp_Object label
+ = (EQ (style, Qimage) || (vert_only && horiz))
+ ? Qnil
+ : PROP (TOOL_BAR_ITEM_LABEL);
ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j);
@@ -5136,8 +5135,11 @@ update_frame_tool_bar (struct frame *f)
/* If there is an existing widget, check if it's stale; if so,
remove it and make a new tool item from scratch. */
- if (ti && xg_tool_item_stale_p (wbutton, stock_name, icon_name,
- img, label, horiz))
+ if (ti && xg_tool_item_stale_p (wbutton, stock_name, icon_name, img,
+ NILP (label)
+ ? NULL
+ : STRINGP (label) ? SSDATA (label) : "",
+ horiz))
{
gtk_container_remove (GTK_CONTAINER (wtoolbar),
GTK_WIDGET (ti));
@@ -5194,7 +5196,11 @@ update_frame_tool_bar (struct frame *f)
#else
if (w) gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
#endif
- ti = xg_make_tool_item (f, w, &wbutton, label, i, horiz, text_image);
+ ti = xg_make_tool_item (f, w, &wbutton,
+ NILP (label)
+ ? NULL
+ : STRINGP (label) ? SSDATA (label) : "",
+ i, horiz, text_image);
gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, j);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 2c5f215: Avoid crashes in Mew due to corrupted tool-bar label,
Eli Zaretskii <=