From 231d05174d844134b60f286dd381b0ee9d391234 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 3 Oct 2015 19:44:26 +0300 Subject: [PATCH] Forgot to release a couple references to Squirrel objects causing a crash when the smart pointers tried to release them after the VM was destroyed. --- source/Core.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/Core.cpp b/source/Core.cpp index 829df6dc..74f70f20 100644 --- a/source/Core.cpp +++ b/source/Core.cpp @@ -363,9 +363,16 @@ bool Core::CreateVM() noexcept void Core::DestroyVM() noexcept { + // See if the Virtual Machine wasn't already destroyed if (m_VM != nullptr) { + // Release the reference to the root table + m_RootTable.reset(); + // Release the references to the script objects + m_Scripts.clear(); + // Close the Virtual Machine sq_close(m_VM); + // Set the virtual machine to null m_VM = nullptr; } }