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

(cherry picked from commit 445746c402)
This commit is contained in:
Naios
2016-07-13 21:58:50 +02:00
parent db85bad1ff
commit 58dd647a88
3 changed files with 55 additions and 14 deletions

View File

@@ -875,6 +875,9 @@ class TC_GAME_API ScriptMgr
/// calls for better performance (bulk changes).
void SwapScriptContext(bool initialize = false);
/// Returns the context name of the static context provided by the worldserver
static std::string const& GetNameOfStaticContext();
/// Acquires a strong module reference to the module containing the given script name,
/// which prevents the shared library which contains the script from unloading.
/// The shared library is lazy unloaded as soon as all references to it are released.