MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / OnUnlinkConCommandBase

Method OnUnlinkConCommandBase

core/ConVarManager.cpp:174–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name)
175{
176 /* Only check convars that have not been created by SourceMod's core */
177 ConVarInfo *pInfo;
178 if (!convar_cache_lookup(name, &pInfo))
179 {
180 return;
181 }
182
183 HandleSecurity sec(NULL, g_pCoreIdent);
184
185 /* Remove it from our cache */
186 m_ConVars.remove(pInfo);
187 convar_cache.remove(name);
188
189 /* Now make sure no plugins are referring to this pointer */
190 IPluginIterator *pl_iter = scripts->GetPluginIterator();
191 while (pl_iter->MorePlugins())
192 {
193 IPlugin *pl = pl_iter->GetPlugin();
194
195 ConVarList *pConVarList;
196 if (pl->GetProperty("ConVarList", (void **)&pConVarList, true)
197 && pConVarList != NULL)
198 {
199 pConVarList->remove(pInfo->pVar);
200 }
201
202 pl_iter->NextPlugin();
203 }
204
205 /* Free resources */
206 handlesys->FreeHandle(pInfo->handle, &sec);
207 delete pInfo;
208}
209
210void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
211{

Callers

nothing calls this directly

Calls 8

convar_cache_lookupFunction · 0.85
GetPropertyMethod · 0.80
FreeHandleMethod · 0.80
removeMethod · 0.45
GetPluginIteratorMethod · 0.45
MorePluginsMethod · 0.45
GetPluginMethod · 0.45
NextPluginMethod · 0.45

Tested by

no test coverage detected