1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Allocate foreign pointer objects in GC-scanned memory.

* libguile/foreign.c (scm_take_foreign_pointer): Allocate RET in
  GC-scanned memory.  This fixes a bug where the object pointed to by
  SCM_CIF in the pair returned by `cif_to_procedure ()' would be
  reclaimed (as a consequence of commit
  087aa6aa31).
This commit is contained in:
Ludovic Courtès 2010-04-09 00:14:34 +02:00
parent b577bc90bb
commit 4551e860f0

View file

@ -89,12 +89,8 @@ scm_take_foreign_pointer (scm_t_foreign_type type, void *ptr, size_t len,
| (finalizer ? (1<<16) : 0) | (len<<17));
if (SCM_UNLIKELY ((word0 >> 17) != len))
scm_out_of_range ("scm_take_foreign_pointer", scm_from_size_t (len));
ret = PTR2SCM (scm_gc_malloc_pointerless (sizeof (scm_t_bits) * 2,
"foreign"));
SCM_SET_CELL_WORD_0 (ret, word0);
SCM_SET_CELL_WORD_1 (ret, (scm_t_bits)ptr);
ret = scm_cell (word0, (scm_t_bits) ptr);
if (finalizer)
{
/* Register a finalizer for the newly created instance. */