diff --git a/rpcs3/util/auto_typemap.hpp b/rpcs3/util/auto_typemap.hpp index 58f5b7d257..fb25e7b8ef 100644 --- a/rpcs3/util/auto_typemap.hpp +++ b/rpcs3/util/auto_typemap.hpp @@ -135,7 +135,12 @@ namespace stx // Destroy objects in reverse order for (; _max; _max--) { - (*--m_info)->destroy(*--m_order); + auto* info = *--m_info; + const u32 type_index = static_cast*>(info)->index(); + info->destroy(*--m_order); + + // Set init to false. We don't want other fxo to use this fxo in their destructor. + m_init[type_index] = false; } // Pointers should be restored to their positions diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index 4df9c57891..6c42f3ad64 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -313,7 +313,12 @@ namespace stx // Destroy objects in reverse order for (; _max; _max--) { - (*--m_info)->destroy(*--m_order); + auto* info = *--m_info; + const u32 type_index = static_cast*>(info)->index(); + info->destroy(*--m_order); + + // Set init to false. We don't want other fxo to use this fxo in their destructor. + m_init[type_index] = false; } // Pointers should be restored to their positions