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 local event type to it's destructor.

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

View File

@ -48,8 +48,6 @@ LocalEvent::LocalEvent(SQInt32 type, bool suspended) noexcept
, m_Textdraws(this)
, m_Vehicles(this)
{
// Receive notification when the VM is about to be closed to release object references
_Core->VMClose.Connect< LocalEvent, &LocalEvent::VMClose >(this);
/* Entity filters are empty so there's nothing to hook right now! */
}
@ -58,9 +56,16 @@ LocalEvent::~LocalEvent()
{
// Detach from all attached signals
Detach();
// Stop receiving notification when the VM is about to be closed
_Core->VMClose.Disconnect< LocalEvent, &LocalEvent::VMClose >(this);
/* The entity filters should 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();
}
// ------------------------------------------------------------------------------------------------
@ -2206,20 +2211,6 @@ void LocalEvent::Adaptable(SQInt32 type, bool inversed) noexcept
}
}
// ------------------------------------------------------------------------------------------------
void LocalEvent::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_LocalFilter(HSQUIRRELVM vm, const SQChar * cname)
{

View File

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