diff options
| author | Paul Eggert | 2015-11-20 13:48:54 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-11-20 13:49:16 -0800 |
| commit | 033811ceec6a2b1cb12c14cb932c0bf583e79020 (patch) | |
| tree | b96b8aa8ccf5a98b5360f2b5b0dd1178dbd6a461 /src | |
| parent | d0e07e0e2239771fd21b9525ea421cf7ba1cc97c (diff) | |
| download | emacs-033811ceec6a2b1cb12c14cb932c0bf583e79020.tar.gz emacs-033811ceec6a2b1cb12c14cb932c0bf583e79020.zip | |
Fix double-decrement bug when freeing global refs
* src/emacs-module.c (module_free_global_ref): Add a FIXME
comment about error reporting. Fix a recently-introduced typo
that double-decremented the refcount.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 84072b9917e..e730ca35ae5 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -293,6 +293,8 @@ module_free_global_ref (emacs_env *env, emacs_value ref) | |||
| 293 | check_main_thread (); | 293 | check_main_thread (); |
| 294 | eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return); | 294 | eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return); |
| 295 | /* TODO: This probably never signals. */ | 295 | /* TODO: This probably never signals. */ |
| 296 | /* FIXME: Wait a minute. Shouldn't this function report an error if | ||
| 297 | the hash lookup fails? */ | ||
| 296 | MODULE_HANDLE_SIGNALS_VOID; | 298 | MODULE_HANDLE_SIGNALS_VOID; |
| 297 | eassert (HASH_TABLE_P (Vmodule_refs_hash)); | 299 | eassert (HASH_TABLE_P (Vmodule_refs_hash)); |
| 298 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); | 300 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); |
| @@ -307,7 +309,7 @@ module_free_global_ref (emacs_env *env, emacs_value ref) | |||
| 307 | EMACS_INT refcount = XFASTINT (value) - 1; | 309 | EMACS_INT refcount = XFASTINT (value) - 1; |
| 308 | if (refcount > 0) | 310 | if (refcount > 0) |
| 309 | { | 311 | { |
| 310 | value = make_natnum (refcount - 1); | 312 | value = make_natnum (refcount); |
| 311 | set_hash_value_slot (h, i, value); | 313 | set_hash_value_slot (h, i, value); |
| 312 | } | 314 | } |
| 313 | else | 315 | else |