[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android a273b95fa50: Merge remote-tracking branch 'origin/master
|
From: |
Po Lu |
|
Subject: |
feature/android a273b95fa50: Merge remote-tracking branch 'origin/master' into feature/android |
|
Date: |
Mon, 3 Jul 2023 02:30:36 -0400 (EDT) |
branch: feature/android
commit a273b95fa505182dfa4686782c464165e14813ba
Merge: 61a38b470de d679f9e388c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
src/frame.c | 13 +++++++++++++
src/xfns.c | 1 -
src/xselect.c | 34 ++++++++++++++++++++++++++++------
3 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/src/frame.c b/src/frame.c
index eee72954ac1..65711106671 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6851,4 +6851,17 @@ iconify the top level frame instead. */);
defsubr (&Sx_parse_geometry);
defsubr (&Sreconsider_frame_fonts);
#endif
+
+#ifdef HAVE_WINDOW_SYSTEM
+ DEFSYM (Qmove_toolbar, "move-toolbar");
+
+ /* The `tool-bar-position' frame parameter is supported on GTK and
+ builds using the internal tool bar. Providing this feature
+ causes menu-bar.el to provide `tool-bar-position' as a user
+ option. */
+
+#if !defined HAVE_EXT_TOOL_BAR || defined USE_GTK
+ Fprovide (Qmove_toolbar, Qnil);
+#endif /* !HAVE_EXT_TOOL_BAR || USE_GTK */
+#endif /* HAVE_WINDOW_SYSTEM */
}
diff --git a/src/xfns.c b/src/xfns.c
index 2046999cf5d..12aef228c3a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -10459,7 +10459,6 @@ eliminated in future versions of Emacs. */);
accepts --with-x-toolkit=gtk. */
Fprovide (intern_c_string ("x-toolkit"), Qnil);
Fprovide (intern_c_string ("gtk"), Qnil);
- Fprovide (intern_c_string ("move-toolbar"), Qnil);
DEFVAR_LISP ("gtk-version-string", Vgtk_version_string,
doc: /* Version info for GTK+. */);
diff --git a/src/xselect.c b/src/xselect.c
index 40be6d4c00c..c38a1f8b6a9 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1989,9 +1989,22 @@ receive_incremental_selection (struct x_display_info
*dpyinfo,
}
+
+/* Free the selection data allocated inside *DATA, which is actually a
+ pointer to unsigned char *. */
+
+static void
+x_free_selection_data (void *data)
+{
+ unsigned char **ptr;
+
+ ptr = data;
+ xfree (*ptr);
+}
+
/* Fetch a value from property PROPERTY of X window WINDOW on display
- DISPLAY. TARGET_TYPE and SELECTION_ATOM are used in error message
- if this fails. */
+ DISPLAY. TARGET_TYPE and SELECTION_ATOM are used in the error
+ message signaled if this fails. */
static Lisp_Object
x_get_window_property_as_lisp_data (struct x_display_info *dpyinfo,
@@ -2007,6 +2020,7 @@ x_get_window_property_as_lisp_data (struct x_display_info
*dpyinfo,
ptrdiff_t bytes = 0, array_bytes;
Lisp_Object val;
Display *display = dpyinfo->display;
+ specpdl_ref count;
/* array_bytes is only used as an argument to xpalloc. The actual
size of the data inside the buffer is inside bytes. */
@@ -2042,6 +2056,13 @@ x_get_window_property_as_lisp_data (struct
x_display_info *dpyinfo,
}
}
+ /* Make sure DATA is freed even if `receive_incremental_connection'
+ quits. Use xfree, not XFree, because x_get_window_property calls
+ xmalloc itself. */
+
+ count = SPECPDL_INDEX ();
+ record_unwind_protect_ptr (x_free_selection_data, &data);
+
if (!for_multiple && actual_type == dpyinfo->Xatom_INCR)
{
/* That wasn't really the data, just the beginning. */
@@ -2051,6 +2072,9 @@ x_get_window_property_as_lisp_data (struct x_display_info
*dpyinfo,
/* Use xfree, not XFree, because x_get_window_property
calls xmalloc itself. */
xfree (data);
+
+ /* In case quitting happens below. */
+ data = NULL;
unblock_input ();
/* Clear bytes again. Previously, receive_incremental_selection
@@ -2077,10 +2101,8 @@ x_get_window_property_as_lisp_data (struct
x_display_info *dpyinfo,
val = selection_data_to_lisp_data (dpyinfo, data, bytes,
actual_type, actual_format);
- /* Use xfree, not XFree, because x_get_window_property
- calls xmalloc itself. */
- xfree (data);
- return val;
+ /* This will also free `data'. */
+ return unbind_to (count, val);
}
/* These functions convert from the selection data read from the server into