diff --git a/include/thallium/engine.hpp b/include/thallium/engine.hpp index 8872442..cdedbda 100644 --- a/include/thallium/engine.hpp +++ b/include/thallium/engine.hpp @@ -253,7 +253,16 @@ class engine { */ engine& operator=(engine&& other) { if(m_impl == other.m_impl) return *this; - if(m_impl) this->~engine(); + if(m_impl && m_impl.use_count() == 1) { + margo_instance_id mid = m_impl->m_mid; + if(mid && m_impl->m_owns_mid) { + if(margo_is_listening(mid)) { + wait_for_finalize(); + } else { + finalize(); + } + } + } m_impl = std::move(other.m_impl); return *this; } @@ -263,7 +272,16 @@ class engine { */ engine& operator=(const engine& other) { if(m_impl == other.m_impl) return *this; - if(m_impl) this->~engine(); + if(m_impl && m_impl.use_count() == 1) { + margo_instance_id mid = m_impl->m_mid; + if(mid && m_impl->m_owns_mid) { + if(margo_is_listening(mid)) { + wait_for_finalize(); + } else { + finalize(); + } + } + } m_impl = other.m_impl; return *this; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a188157..545f9fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ set (thallium-pkg "share/cmake/thallium") # set (THALLIUM_VERSION_MAJOR 0) set (THALLIUM_VERSION_MINOR 11) -set (THALLIUM_VERSION_PATCH 1) +set (THALLIUM_VERSION_PATCH 2) set (thallium-vers "${THALLIUM_VERSION_MAJOR}.${THALLIUM_VERSION_MINOR}") set (THALLIUM_VERSION "${thallium-vers}.${THALLIUM_VERSION_PATCH}")