mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11477] Correctly unload scriptlib at errors.
This will prevent unexpected call some handlers for "unloaded" sriptlib DLL.
This commit is contained in:
parent
8931b7ca11
commit
7e79c611ec
2 changed files with 8 additions and 3 deletions
|
|
@ -1118,8 +1118,9 @@ ScriptLoadResult ScriptMgr::LoadScriptLibrary(const char* libName)
|
|||
GetScriptHookPtr((P), (N)); \
|
||||
if (!(P)) \
|
||||
{ \
|
||||
MANGOS_CLOSE_LIBRARY(m_hScriptLib); \
|
||||
m_hScriptLib = NULL; \
|
||||
/* prevent call before init */ \
|
||||
m_pOnFreeScriptLibrary = NULL; \
|
||||
UnloadScriptLibrary(); \
|
||||
return SCRIPT_LOAD_ERR_WRONG_API; \
|
||||
}
|
||||
|
||||
|
|
@ -1160,7 +1161,11 @@ ScriptLoadResult ScriptMgr::LoadScriptLibrary(const char* libName)
|
|||
# undef GET_SCRIPT_HOOK_PTR
|
||||
|
||||
if (strcmp(pGetMangosRevStr(), REVISION_NR) != 0)
|
||||
{
|
||||
m_pOnFreeScriptLibrary = NULL; // prevent call before init
|
||||
UnloadScriptLibrary();
|
||||
return SCRIPT_LOAD_ERR_OUTDATED;
|
||||
}
|
||||
|
||||
m_pOnInitScriptLibrary();
|
||||
return SCRIPT_LOAD_OK;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11476"
|
||||
#define REVISION_NR "11477"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue