From e2f613e06359c66a7f412eb7b210c8d032933c0d Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Tue, 20 May 2014 16:11:28 -0600 Subject: [PATCH] cleanly destroy MyProcessor to allow for creating/destroying VMs in the same process multiple times --- src/compile.cpp | 2 ++ src/interpret.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compile.cpp b/src/compile.cpp index 3e853d1b39..cd13d8f59a 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -8935,6 +8935,8 @@ class MyProcessor: public Processor { signals.unregisterHandler(SignalRegistrar::DivideByZero); signals.setCrashDumpDirectory(0); + this->~MyProcessor(); + allocator->free(this, sizeof(*this)); } diff --git a/src/interpret.cpp b/src/interpret.cpp index b429aaaf93..cf8e296e49 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -3263,8 +3263,9 @@ class MyProcessor: public Processor { } virtual void dispose() { - allocator->free(this, sizeof(*this)); signals.setCrashDumpDirectory(0); + this->~MyProcessor(); + allocator->free(this, sizeof(*this)); } System* s;