From 190e18c75b2d1f669ee3bc767f34542fd73b2961 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 16 Sep 2019 11:39:42 +0300 Subject: [PATCH] Add assertion that thread is suspended when using context registers * win32_threads.c (GC_push_stack_for): Add assertion that thread is suspended (before using context registers) if thread is not self and not blocked. --- win32_threads.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win32_threads.c b/win32_threads.c index 3a44f563..bd1bbc86 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1600,6 +1600,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) /* require looping. */ word *regs = thread->context_regs; + GC_ASSERT(thread->suspended); sp = thread->context_sp; # else /* For unblocked threads call GetThreadContext(). */ @@ -1607,6 +1608,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) { CONTEXT context; + GC_ASSERT(thread->suspended); context.ContextFlags = GET_THREAD_CONTEXT_FLAGS; if (!GetThreadContext(THREAD_HANDLE(thread), &context)) ABORT("GetThreadContext failed"); -- 2.50.1