1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 07:07:13 +02:00

Introduce a new module event to be called after the virtual machine was destroyed. Thus, preventing the release of the virtual machine while still in use.

Prevent releasing IRC sessions while they could still be in use.
Few other changes that had to be committed because of the change in the module API.
This commit is contained in:
Sandu Liviu Catalin
2016-06-26 16:18:23 +03:00
parent 2ee475bb8d
commit 996c078105
11 changed files with 94 additions and 158 deletions

View File

@ -82,9 +82,15 @@ void OnSquirrelTerminate()
NullTable().Release();
NullArray().Release();
NullFunction().ReleaseGently();
}
/* ------------------------------------------------------------------------------------------------
* The virtual machined was closed and all memory associated with it was released.
*/
void OnSquirrelReleased()
{
// Release the current virtual machine, if any
DefaultVM::Set(nullptr);
// Release script resources...
}
/* ------------------------------------------------------------------------------------------------
@ -125,6 +131,9 @@ static uint8_t OnPluginCommand(uint32_t command_identifier, CCStr message)
case SQMOD_TERMINATE_CMD:
OnSquirrelTerminate();
break;
case SQMOD_RELEASED_CMD:
OnSquirrelReleased();
break;
default: break;
}
return 1;