mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 03:57:14 +01:00
Properly terminate all command controllers and release their resources and callbacks to prevent a server crash at shutdown since callbacks were not released.
This commit is contained in:
parent
c854700cac
commit
498c02fa83
@ -1193,7 +1193,7 @@ void Register_Command(HSQUIRRELVM vm)
|
||||
*/
|
||||
void TerminateCommands()
|
||||
{
|
||||
Cmd::Controller::ClearAll();
|
||||
Cmd::Controller::Terminate();
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
@ -504,13 +504,17 @@ protected:
|
||||
public:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Clear the command listeners from all controllers.
|
||||
* Terminate the all controllers by releasing their command listeners and callbacks.
|
||||
*/
|
||||
static void ClearAll()
|
||||
static void Terminate()
|
||||
{
|
||||
for (auto & ctr : s_Controllers)
|
||||
{
|
||||
// Clear the command listeners
|
||||
ctr->Clear();
|
||||
// Release the script callbacks, if any
|
||||
ctr->m_OnFail.ReleaseGently();
|
||||
ctr->m_OnAuth.ReleaseGently();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user