aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp16
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp8
2 files changed, 15 insertions, 9 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 0e8bc517ca8..322facbce25 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -166,7 +166,8 @@ class ScriptRegistryCompositum
public:
void SetScriptNameInContext(std::string const& scriptname, std::string const& context)
{
- ASSERT(_scriptnames_to_context.find(scriptname) == _scriptnames_to_context.end());
+ ASSERT(_scriptnames_to_context.find(scriptname) == _scriptnames_to_context.end(),
+ "Scriptname was assigned to this context already!");
_scriptnames_to_context.insert(std::make_pair(scriptname, context));
}
@@ -180,15 +181,18 @@ public:
void ReleaseContext(std::string const& context) final override
{
+ for (auto const registry : _registries)
+ registry->ReleaseContext(context);
+
+ // Clear the script names in context after calling the release hooks
+ // since it's possible that new references to a shared library
+ // are acquired when releasing.
for (auto itr = _scriptnames_to_context.begin();
itr != _scriptnames_to_context.end();)
if (itr->second == context)
itr = _scriptnames_to_context.erase(itr);
else
++itr;
-
- for (auto const registry : _registries)
- registry->ReleaseContext(context);
}
void SwapContext(bool initialize) final override
@@ -604,7 +608,7 @@ public:
swapped = true;
}
- void BeforeSwapContext(bool initialize) override
+ void BeforeSwapContext(bool /*initialize*/) override
{
swapped = false;
}
@@ -634,7 +638,7 @@ public:
swapped = true;
}
- void BeforeSwapContext(bool initialize) override
+ void BeforeSwapContext(bool /*initialize*/) override
{
if (swapped)
{
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index b2c8e47a54c..2f3d6126a9d 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -117,7 +117,7 @@ public:
if (!success)
{
- TC_LOG_ERROR("scripts.hotswap", "Failed to close the shared library \"%s\".",
+ TC_LOG_ERROR("scripts.hotswap", "Failed to unload (syscall) the shared library \"%s\".",
_path.generic_string().c_str());
return;
@@ -893,8 +893,10 @@ private:
if (!ref->second.unique())
{
TC_LOG_INFO("scripts.hotswap",
- "Script module %s is still used by %lu scripts. "
- "Will lazy unload the module once all scripts stopped using it.",
+ "Script module %s is still used by %lu spell, aura or instance scripts. "
+ "Will lazy unload the module once all scripts stopped using it, "
+ "to use the latest version of an edited script unbind yourself from "
+ "the instance or re-cast the spell.",
ref->second->GetScriptModule(), ref->second.use_count() - 1);
}