diff options
| author | Paul Eggert | 2020-08-15 10:48:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-08-15 11:19:51 -0700 |
| commit | d0145537fa511a44e2a4af01da3947e92f0b8331 (patch) | |
| tree | 0b098e725155c3b40031e0ecb8c65bbb25a6e402 /src/font.c | |
| parent | 4cba236749aafade7bd88cf2a10be48f44983faa (diff) | |
| download | emacs-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/font.c')
| -rw-r--r-- | src/font.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/font.c b/src/font.c index ab00402b40b..ccbd3fc9ce6 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -4889,7 +4889,7 @@ the corresponding element is nil. */) | |||
| 4889 | { | 4889 | { |
| 4890 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); | 4890 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); |
| 4891 | ptrdiff_t len; | 4891 | ptrdiff_t len; |
| 4892 | Lisp_Object *chars, vec; | 4892 | Lisp_Object *chars; |
| 4893 | USE_SAFE_ALLOCA; | 4893 | USE_SAFE_ALLOCA; |
| 4894 | 4894 | ||
| 4895 | if (NILP (object)) | 4895 | if (NILP (object)) |
| @@ -4957,7 +4957,7 @@ the corresponding element is nil. */) | |||
| 4957 | else | 4957 | else |
| 4958 | wrong_type_argument (Qarrayp, object); | 4958 | wrong_type_argument (Qarrayp, object); |
| 4959 | 4959 | ||
| 4960 | vec = make_uninit_vector (len); | 4960 | Lisp_Object vec = make_nil_vector (len); |
| 4961 | for (ptrdiff_t i = 0; i < len; i++) | 4961 | for (ptrdiff_t i = 0; i < len; i++) |
| 4962 | { | 4962 | { |
| 4963 | Lisp_Object g; | 4963 | Lisp_Object g; |
| @@ -5203,7 +5203,7 @@ If the named font cannot be opened and loaded, return nil. */) | |||
| 5203 | static Lisp_Object | 5203 | static Lisp_Object |
| 5204 | build_style_table (const struct table_entry *entry, int nelement) | 5204 | build_style_table (const struct table_entry *entry, int nelement) |
| 5205 | { | 5205 | { |
| 5206 | Lisp_Object table = make_uninit_vector (nelement); | 5206 | Lisp_Object table = make_nil_vector (nelement); |
| 5207 | for (int i = 0; i < nelement; i++) | 5207 | for (int i = 0; i < nelement; i++) |
| 5208 | { | 5208 | { |
| 5209 | int j; | 5209 | int j; |