[coop] Fix mono_stack_mark_pop
authorAleksey Kliger <aleksey@xamarin.com>
Wed, 16 Nov 2016 21:44:56 +0000 (16:44 -0500)
committerAleksey Kliger <aleksey@xamarin.com>
Thu, 17 Nov 2016 16:13:52 +0000 (11:13 -0500)
We need to restore the old size into the old top chunk, not the current
top chunk.

mono/metadata/handle.h

index 9cf5f49655eaf1a09975a7ae5c6b702c749f967c..25ce103a09ca6fb7be63832b8ca3fae5fb823a38 100644 (file)
@@ -91,9 +91,10 @@ static inline void
 mono_stack_mark_pop (MonoThreadInfo *info, HandleStackMark *stackmark)
 {
        HandleStack *handles = (HandleStack *)info->handle_stack;
-       handles->top->size = stackmark->size;
+       HandleChunk *old_top = stackmark->chunk;
+       old_top->size = stackmark->size;
        mono_memory_write_barrier ();
-       handles->top = stackmark->chunk;
+       handles->top = old_top;
 }
 
 /*