- sourcemod can now unload properly without crashing
- extensions now unload, dependencies are resolved --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401024
This commit is contained in:
parent
5e7b7589be
commit
271a8b5b56
@ -498,6 +498,15 @@ size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, c
|
||||
|
||||
void SourceModBase::CloseSourceMod()
|
||||
{
|
||||
/* Force a level end */
|
||||
LevelShutdown();
|
||||
|
||||
/* Unload plugins */
|
||||
g_PluginSys.Shutdown();
|
||||
|
||||
/* Unload extensions */
|
||||
g_Extensions.Shutdown();
|
||||
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
|
||||
if (g_Loaded)
|
||||
|
@ -280,6 +280,16 @@ void CExtensionManager::OnSourceModShutdown()
|
||||
g_ShareSys.DestroyIdentType(g_ExtType);
|
||||
}
|
||||
|
||||
void CExtensionManager::Shutdown()
|
||||
{
|
||||
List<CExtension *>::iterator iter;
|
||||
|
||||
while ((iter = m_Libs.begin()) != m_Libs.end())
|
||||
{
|
||||
UnloadExtension((*iter));
|
||||
}
|
||||
}
|
||||
|
||||
void CExtensionManager::TryAutoload()
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
@ -603,6 +613,8 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
||||
}
|
||||
}
|
||||
|
||||
delete pExt;
|
||||
|
||||
List<CExtension *>::iterator iter;
|
||||
for (iter=UnloadQueue.begin(); iter!=UnloadQueue.end(); iter++)
|
||||
{
|
||||
|
@ -101,6 +101,7 @@ public:
|
||||
void TryAutoload();
|
||||
public:
|
||||
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
||||
void Shutdown();
|
||||
private:
|
||||
CExtension *FindByOrder(unsigned int num);
|
||||
private:
|
||||
|
@ -716,6 +716,16 @@ CPluginManager::~CPluginManager()
|
||||
m_iters.popall();
|
||||
}
|
||||
|
||||
void CPluginManager::Shutdown()
|
||||
{
|
||||
List<CPlugin *>::iterator iter;
|
||||
|
||||
while ((iter = m_plugins.begin()) != m_plugins.end())
|
||||
{
|
||||
UnloadPlugin(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
void CPluginManager::LoadAll_FirstPass(const char *config, const char *basedir)
|
||||
{
|
||||
/* First read in the database of plugin settings */
|
||||
|
@ -376,6 +376,8 @@ public:
|
||||
|
||||
CPlugin *GetPluginFromIdentity(IdentityToken_t *pToken);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user