From 93662b8b1852a6ad28bedceb47f5848a0528dc9a Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 29 Jul 2019 17:27:46 +0300 Subject: [PATCH] Fix runtime deinit sequence. (#3227) --- runtime/src/main/cpp/Memory.cpp | 2 -- runtime/src/main/cpp/Runtime.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index 2fcf7202b97..4e6226e4001 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -1552,7 +1552,6 @@ MemoryState* suspendMemory() { } void resumeMemory(MemoryState* state) { - RuntimeAssert(::memoryState == nullptr, "Cannot schedule on existing state"); ::memoryState = state; } @@ -2489,7 +2488,6 @@ MemoryState* InitMemory() { } void DeinitMemory(MemoryState* memoryState) { - ::memoryState = memoryState; deinitMemory(memoryState); } diff --git a/runtime/src/main/cpp/Runtime.cpp b/runtime/src/main/cpp/Runtime.cpp index 39b575fe1e2..017e16b14fd 100644 --- a/runtime/src/main/cpp/Runtime.cpp +++ b/runtime/src/main/cpp/Runtime.cpp @@ -101,6 +101,7 @@ RuntimeState* initRuntime() { } void deinitRuntime(RuntimeState* state) { + ResumeMemory(state->memoryState); bool lastRuntime = atomicAdd(&aliveRuntimesCount, -1) == 0; InitOrDeinitGlobalVariables(DEINIT_THREAD_LOCAL_GLOBALS); if (lastRuntime)