1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Move the resource releasing from the global event type to it's destructor.

This commit is contained in:
Sandu Liviu Catalin 2015-10-31 21:27:21 +02:00
parent d937be3e37
commit ab78f53875
2 changed files with 9 additions and 22 deletions

View File

@ -50,8 +50,6 @@ GlobalEvent::GlobalEvent(SQInt32 type, bool suspended) noexcept
{
// Attach to the specified event signal
Attach();
// Receive notification when the VM is about to be closed to release object references
_Core->VMClose.Connect< GlobalEvent, &GlobalEvent::VMClose >(this);
/* Entity filters are empty so there's nothing to hook to! */
}
@ -60,9 +58,16 @@ GlobalEvent::~GlobalEvent()
{
// Detach from the specified event signal
Detach();
// Stop receiving notification when the VM is about to be closed
_Core->VMClose.Disconnect< GlobalEvent, &GlobalEvent::VMClose >(this);
/* We're expecting the entity filters to unhook themselves from the destroy signal! */
// Release the reference to the specified callbacks
m_OnTrigger.Release2();
m_OnInclude.Release2();
m_OnExclude.Release2();
m_OnCleared.Release2();
m_OnRelease.Release2();
// Release the reference to the specified user data
m_Data.Release();
}
// ------------------------------------------------------------------------------------------------
@ -2063,19 +2068,6 @@ void GlobalEvent::Adaptable(SQInt32 type) noexcept
}
}
// ------------------------------------------------------------------------------------------------
void GlobalEvent::VMClose() noexcept
{
// Release the reference to the specified callbacks
m_OnTrigger.Release2();
m_OnInclude.Release2();
m_OnExclude.Release2();
m_OnCleared.Release2();
m_OnRelease.Release2();
// Release the reference to the specified user data
m_Data.Release();
}
// ================================================================================================
template < class T > static bool Register_GlobalFilter(HSQUIRRELVM vm, const SQChar * cname)
{

View File

@ -1005,11 +1005,6 @@ public:
*/
void SphereExited(SQInt32 player, SQInt32 sphere) noexcept;
/* --------------------------------------------------------------------------------------------
* ...
*/
void VMClose() noexcept;
protected:
/* --------------------------------------------------------------------------------------------