diff options
| author | Paul Eggert | 2019-07-21 12:31:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-21 12:32:16 -0700 |
| commit | 5d4dd552c29279b8a9e6ed269a2dc3afc36f73b9 (patch) | |
| tree | 95edeff83e756072c35f974f6271ba8c191d8436 /src/alloc.c | |
| parent | d02c2f7f6507105605ed0596a7e26acd5b3b8122 (diff) | |
| download | emacs-5d4dd552c29279b8a9e6ed269a2dc3afc36f73b9.tar.gz emacs-5d4dd552c29279b8a9e6ed269a2dc3afc36f73b9.zip | |
Fix lifetime error in previous patch
Problem reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00520.html
* src/alloc.c (inhibit_garbage_collection): Use new function.
(allow_garbage_collection): Accept intmax_t, not pointer.
* src/eval.c (default_toplevel_binding, do_one_unbind)
(backtrace_eval_unrewind, Fbacktrace__locals, mark_specpdl):
Support SPECPDL_UNWIND_INTMAX.
(record_unwind_protect_excursion): New function.
* src/lisp.h (enum specbind_tag): New constant SPECPDL_UNWIND_INTMAX.
(union specbinding): New member unwind_intmax.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index 50015808e59..aa9200f2ebb 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5505,10 +5505,9 @@ staticpro (Lisp_Object const *varaddress) | |||
| 5505 | consing_until_gc to speed up maybe_gc when GC is inhibited. */ | 5505 | consing_until_gc to speed up maybe_gc when GC is inhibited. */ |
| 5506 | 5506 | ||
| 5507 | static void | 5507 | static void |
| 5508 | allow_garbage_collection (void *ptr) | 5508 | allow_garbage_collection (intmax_t consing) |
| 5509 | { | 5509 | { |
| 5510 | object_ct *p = ptr; | 5510 | consing_until_gc = consing; |
| 5511 | consing_until_gc = *p; | ||
| 5512 | garbage_collection_inhibited--; | 5511 | garbage_collection_inhibited--; |
| 5513 | } | 5512 | } |
| 5514 | 5513 | ||
| @@ -5516,8 +5515,7 @@ ptrdiff_t | |||
| 5516 | inhibit_garbage_collection (void) | 5515 | inhibit_garbage_collection (void) |
| 5517 | { | 5516 | { |
| 5518 | ptrdiff_t count = SPECPDL_INDEX (); | 5517 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5519 | object_ct consing = consing_until_gc; | 5518 | record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc); |
| 5520 | record_unwind_protect_ptr (allow_garbage_collection, &consing); | ||
| 5521 | garbage_collection_inhibited++; | 5519 | garbage_collection_inhibited++; |
| 5522 | consing_until_gc = OBJECT_CT_MAX; | 5520 | consing_until_gc = OBJECT_CT_MAX; |
| 5523 | return count; | 5521 | return count; |