aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
authorPaul Eggert2020-08-15 10:48:36 -0700
committerPaul Eggert2020-08-15 11:19:51 -0700
commitd0145537fa511a44e2a4af01da3947e92f0b8331 (patch)
tree0b098e725155c3b40031e0ecb8c65bbb25a6e402 /src/xselect.c
parent4cba236749aafade7bd88cf2a10be48f44983faa (diff)
downloademacs-d0145537fa511a44e2a4af01da3947e92f0b8331.tar.gz
emacs-d0145537fa511a44e2a4af01da3947e92f0b8331.zip
Fix GC bugs related to uninitialized vectors
Avoid problems if GC occurs while initializing a vector. Problem with Fdelete reported by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00313.html I looked for similar problems elsewhere and found quite a few. * src/coding.c (make_subsidiaries): * src/composite.c (syms_of_composite): * src/font.c (build_style_table, Ffont_get_glyphs): * src/nsselect.m (clean_local_selection_data): * src/nsxwidget.m (js_to_lisp): * src/syntax.c (init_syntax_once): * src/window.c (Fcurrent_window_configuration): * src/xselect.c (selection_data_to_lisp_data) (clean_local_selection_data): Use make_nil_vector instead of make_uninit_vector. * src/fns.c (Fdelete): * src/xwidget.c (webkit_js_to_lisp): Use allocate_nil_vector instead of allocate_vector. * src/search.c (Fnewline_cache_check): Use make_vector instead of make_uninit_vector.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 48d6215a7bb..bf50c598b2a 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1594,7 +1594,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1594 return x_atom_to_symbol (dpyinfo, (Atom) idata[0]); 1594 return x_atom_to_symbol (dpyinfo, (Atom) idata[0]);
1595 else 1595 else
1596 { 1596 {
1597 Lisp_Object v = make_uninit_vector (size / sizeof (int)); 1597 Lisp_Object v = make_nil_vector (size / sizeof (int));
1598 1598
1599 for (i = 0; i < size / sizeof (int); i++) 1599 for (i = 0; i < size / sizeof (int); i++)
1600 ASET (v, i, x_atom_to_symbol (dpyinfo, (Atom) idata[i])); 1600 ASET (v, i, x_atom_to_symbol (dpyinfo, (Atom) idata[i]));
@@ -1653,7 +1653,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1653 else 1653 else
1654 { 1654 {
1655 ptrdiff_t i; 1655 ptrdiff_t i;
1656 Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE); 1656 Lisp_Object v = make_nil_vector (size / X_LONG_SIZE);
1657 1657
1658 if (type == XA_INTEGER) 1658 if (type == XA_INTEGER)
1659 { 1659 {
@@ -1860,7 +1860,7 @@ clean_local_selection_data (Lisp_Object obj)
1860 Lisp_Object copy; 1860 Lisp_Object copy;
1861 if (size == 1) 1861 if (size == 1)
1862 return clean_local_selection_data (AREF (obj, 0)); 1862 return clean_local_selection_data (AREF (obj, 0));
1863 copy = make_uninit_vector (size); 1863 copy = make_nil_vector (size);
1864 for (i = 0; i < size; i++) 1864 for (i = 0; i < size; i++)
1865 ASET (copy, i, clean_local_selection_data (AREF (obj, i))); 1865 ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
1866 return copy; 1866 return copy;