Added initial console commands for plugins
fixed crash in plugin destructor fixed compilation not being freed causing a crash fixed small issues in plugin system fixed plugin iterator not being reseted when freed and not being initialized it's current pointer. fixed a bug where insertion of a prefixed string would not check whether a value could be set. --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40221
This commit is contained in:
@@ -40,12 +40,6 @@ CPlugin::~CPlugin()
|
||||
m_ctx.co = NULL;
|
||||
}
|
||||
|
||||
if (m_plugin)
|
||||
{
|
||||
g_pSourcePawn->FreeFromMemory(m_plugin);
|
||||
m_plugin = NULL;
|
||||
}
|
||||
|
||||
if (m_pub_funcs)
|
||||
{
|
||||
for (uint32_t i=0; i<m_plugin->info.publics_num; i++)
|
||||
@@ -56,6 +50,12 @@ CPlugin::~CPlugin()
|
||||
m_pub_funcs = NULL;
|
||||
}
|
||||
|
||||
if (m_plugin)
|
||||
{
|
||||
g_pSourcePawn->FreeFromMemory(m_plugin);
|
||||
m_plugin = NULL;
|
||||
}
|
||||
|
||||
if (m_priv_funcs)
|
||||
{
|
||||
for (unsigned int i=0; i<m_funcsnum; i++)
|
||||
@@ -193,6 +193,7 @@ bool CPlugin::FinishMyCompile(char *error, size_t maxlength)
|
||||
}
|
||||
|
||||
m_status = Plugin_Created;
|
||||
m_ctx.co = NULL;
|
||||
|
||||
UpdateInfo();
|
||||
|
||||
@@ -344,6 +345,8 @@ bool CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
|
||||
maxlength = sizeof(m_errormsg);
|
||||
}
|
||||
|
||||
m_status = Plugin_Loaded;
|
||||
|
||||
int err;
|
||||
cell_t result;
|
||||
IPluginFunction *pFunction = GetFunctionByName("AskPluginLoad");
|
||||
@@ -371,8 +374,6 @@ bool CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_status = Plugin_Loaded;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -447,6 +448,7 @@ bool CPlugin::SetPauseState(bool paused)
|
||||
CPluginManager::CPluginIterator::CPluginIterator(List<CPlugin *> *_mylist)
|
||||
{
|
||||
mylist = _mylist;
|
||||
Reset();
|
||||
}
|
||||
|
||||
IPlugin *CPluginManager::CPluginIterator::GetPlugin()
|
||||
@@ -500,6 +502,7 @@ void CPluginManager::LoadAll_FirstPass(const char *config, const char *basedir)
|
||||
/* First read in the database of plugin settings */
|
||||
SMCParseError err;
|
||||
unsigned int line, col;
|
||||
m_AllPluginsLoaded = false;
|
||||
if ((err=g_TextParse.ParseFile_SMC(config, &m_PluginInfo, &line, &col)) != SMCParse_Okay)
|
||||
{
|
||||
/* :TODO: log the error, don't bail out though */
|
||||
@@ -668,7 +671,7 @@ IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType typ
|
||||
CPlugin *pPlugin;
|
||||
if (sm_trie_retrieve(m_LoadLookup, checkpath, (void **)&pPlugin))
|
||||
{
|
||||
snprintf(error, err_max, "Plugin file is alread loaded");
|
||||
snprintf(error, err_max, "Plugin file is already loaded");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -743,6 +746,7 @@ void CPluginManager::LoadAll_SecondPass()
|
||||
RunSecondPass(pPlugin);
|
||||
}
|
||||
}
|
||||
m_AllPluginsLoaded = true;
|
||||
}
|
||||
|
||||
void CPluginManager::RunSecondPass(CPlugin *pPlugin)
|
||||
@@ -828,6 +832,7 @@ IPluginIterator *CPluginManager::GetPluginIterator()
|
||||
} else {
|
||||
CPluginIterator *iter = m_iters.front();
|
||||
m_iters.pop();
|
||||
iter->Reset();
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user