Fix runtime deinit sequence. (#3227)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user