Core/Scripting: Fix acquiring of references between script swaps

* Delay unloading of shared libraries to the next update tick
  to prevent crashes in the destructor of the last referenced
  script instance.
* Closes #17557
This commit is contained in:
Naios authored and Aokromes committed 2016-08-10 09:05:43 +02:00
1 parent a354feb48b
commit efa3d00ebf
3 files changed
+55 -14

No files matched your search

+7 -1
View File
@@ -987,7 +987,7 @@ void ScriptMgr::Initialize()
FillSpellSummary();
// Load core scripts
SetScriptContext("___static___");
SetScriptContext(GetNameOfStaticContext());
// SmartAI
AddSC_SmartScripts();
@@ -1043,6 +1043,12 @@ void ScriptMgr::SwapScriptContext(bool initialize)
_currentContext.clear();
}
std::string const& ScriptMgr::GetNameOfStaticContext()
{
static std::string const name = "___static___";
return name;
}
void ScriptMgr::ReleaseScriptContext(std::string const& context)
{
sScriptRegistryCompositum->ReleaseContext(context);