diff options
| author | Pip Cet | 2021-03-07 21:26:29 +0000 |
|---|---|---|
| committer | Andrea Corallo | 2021-03-09 09:25:27 +0100 |
| commit | 93f92cf1ba37f8b9abaee4b9487705bae464c4e0 (patch) | |
| tree | 5d1c5111b79b5cedeba1d5098e560946986cd9af /src/comp.c | |
| parent | 15aa239ba058ef02544e5dfaf066bd985d9b2f4f (diff) | |
| download | emacs-93f92cf1ba37f8b9abaee4b9487705bae464c4e0.tar.gz emacs-93f92cf1ba37f8b9abaee4b9487705bae464c4e0.zip | |
Zero stale pointer when unloading comp units (bug#46256)
* src/alloc.c (cleanup_vector): Call unload_comp_unit.
* src/comp.c (unload_comp_unit): New function.
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c index e6f672de254..e1809785410 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -4949,6 +4949,20 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 4949 | return res; | 4949 | return res; |
| 4950 | } | 4950 | } |
| 4951 | 4951 | ||
| 4952 | void | ||
| 4953 | unload_comp_unit (struct Lisp_Native_Comp_Unit *cu) | ||
| 4954 | { | ||
| 4955 | if (cu->handle == NULL) | ||
| 4956 | return; | ||
| 4957 | |||
| 4958 | Lisp_Object *saved_cu = dynlib_sym (cu->handle, COMP_UNIT_SYM); | ||
| 4959 | Lisp_Object this_cu; | ||
| 4960 | XSETNATIVE_COMP_UNIT (this_cu, cu); | ||
| 4961 | if (EQ (this_cu, *saved_cu)) | ||
| 4962 | *saved_cu = Qnil; | ||
| 4963 | dynlib_close (cu->handle); | ||
| 4964 | } | ||
| 4965 | |||
| 4952 | Lisp_Object | 4966 | Lisp_Object |
| 4953 | native_function_doc (Lisp_Object function) | 4967 | native_function_doc (Lisp_Object function) |
| 4954 | { | 4968 | { |