Skip to content

Commit

Permalink
Use sgen_is_object_alive_for_current_gen () instead of sgen_is_object…
Browse files Browse the repository at this point in the history
…_alive (), the latter doesn't work for oldspace objects, causing the gc handle to be freed even through the object is still alive. Fixes mono#6490.
  • Loading branch information
vargaz authored and monojenkins committed Jan 29, 2018
1 parent e131c9c commit ff0a912
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mono/sgen/sgen-gchandles.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ scan_for_weak (gpointer hidden, GCHandleType handle_type, int max_generation, gp
GCObject *obj = (GCObject *)MONO_GC_REVEAL_POINTER (hidden, is_weak);

/* If the object is dead we free the gc handle */
if (!sgen_is_object_alive (obj))
if (!sgen_is_object_alive_for_current_gen (obj))
return NULL;

/* Relocate it */
Expand All @@ -421,7 +421,7 @@ scan_for_weak (gpointer hidden, GCHandleType handle_type, int max_generation, gp
GCObject *field = *addr;

/* if the object in the weak field is alive, we relocate it */
if (field && sgen_is_object_alive (field))
if (field && sgen_is_object_alive_for_current_gen (field))
ctx->ops->copy_or_mark_object (addr, ctx->queue);
else
*addr = NULL;
Expand Down

0 comments on commit ff0a912

Please sign in to comment.