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

Method OnSourceModShutdown

core/ConVarManager.cpp:115–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void ConVarManager::OnSourceModShutdown()
116{
117 List<ConVarInfo *>::iterator iter = m_ConVars.begin();
118 HandleSecurity sec(NULL, g_pCoreIdent);
119
120 /* Iterate list of ConVarInfo structures, remove every one of them */
121 while (iter != m_ConVars.end())
122 {
123 ConVarInfo *pInfo = (*iter);
124
125 iter = m_ConVars.erase(iter);
126
127 handlesys->FreeHandle(pInfo->handle, &sec);
128 if (pInfo->pChangeForward != NULL)
129 {
130 forwardsys->ReleaseForward(pInfo->pChangeForward);
131 }
132 if (pInfo->sourceMod)
133 {
134 /* If we created it, we won't be tracking it, therefore it is
135 * safe to remove everything in one go.
136 */
137 META_UNREGCVAR(pInfo->pVar);
138 delete [] pInfo->pVar->GetName();
139 delete [] pInfo->pVar->GetHelpText();
140 delete [] pInfo->pVar->GetDefault();
141 delete pInfo->pVar;
142 }
143 else
144 {
145 /* If we didn't create it, we might be tracking it. Also,
146 * it could be unreadable.
147 */
148 UntrackConCommandBase(pInfo->pVar, this);
149 }
150
151 /* It's not safe to read the name here, so we simply delete the
152 * the info struct and clear the lookup cache at the end.
153 */
154 delete pInfo;
155 }
156 convar_cache.clear();
157
158 g_Players.RemoveClientListener(this);
159
160 /* Remove the 'convars' option from the 'sm' console command */
161 rootmenu->RemoveRootConsoleCommand("cvars", this);
162
163 scripts->RemovePluginsListener(this);
164
165 /* Remove the 'ConVar' handle type */
166 handlesys->RemoveType(m_ConVarType, g_pCoreIdent);
167}
168
169bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
170{

Callers

nothing calls this directly

Calls 12

UntrackConCommandBaseFunction · 0.85
FreeHandleMethod · 0.80
ReleaseForwardMethod · 0.80
RemoveClientListenerMethod · 0.80
RemoveTypeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
GetNameMethod · 0.45
clearMethod · 0.45
RemovePluginsListenerMethod · 0.45

Tested by

no test coverage detected