Fix crash on hot-reload in Editor due to leftover scripting events in ScriptingEvents::EventsTable

#1925
This commit is contained in:
Wojtek Figat
2023-11-16 14:09:05 +01:00
parent d33bf2fa6a
commit 9738fd4354

View File

@@ -693,6 +693,14 @@ void BinaryModule::Destroy(bool isReloading)
}
}
// Remove any scripting events
for (auto i = ScriptingEvents::EventsTable.Begin(); i.IsNotEnd(); ++i)
{
const ScriptingTypeHandle type = i->Key.First;
if (type.Module == this)
ScriptingEvents::EventsTable.Remove(i);
}
// Unregister
GetModules().RemoveKeepOrder(this);
}