1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-03-15 16:47:13 +01:00

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

This commit is contained in:
Sandu Liviu Catalin 2015-10-31 21:27:06 +02:00
parent a2a02a6c9d
commit d937be3e37
2 changed files with 4 additions and 18 deletions

View File

@ -34,16 +34,16 @@ BasicEvent::BasicEvent(SQInt32 type, bool suspended) noexcept
, m_Suspended(suspended) , m_Suspended(suspended)
{ {
Attach(); Attach();
// Receive notification when the VM is about to be closed to release object references
_Core->VMClose.Connect< BasicEvent, &BasicEvent::VMClose >(this);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
BasicEvent::~BasicEvent() BasicEvent::~BasicEvent()
{ {
Detach(); Detach();
// Stop receiving notification when the VM is about to be closed // Release the reference to the specified callback
_Core->VMClose.Disconnect< BasicEvent, &BasicEvent::VMClose >(this); m_OnTrigger.Release2();
// Release the reference to the specified user data
m_Data.Release();
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1905,15 +1905,6 @@ void BasicEvent::Detach() noexcept
} }
} }
// ------------------------------------------------------------------------------------------------
void BasicEvent::VMClose() noexcept
{
// Release the reference to the specified callback
m_OnTrigger.Release2();
// Release the reference to the specified user data
m_Data.Release();
}
// ================================================================================================ // ================================================================================================
bool Register_BasicEvent(HSQUIRRELVM vm) bool Register_BasicEvent(HSQUIRRELVM vm)
{ {

View File

@ -757,11 +757,6 @@ public:
*/ */
void LogMessage(SQInt32 type, const SQChar * message) noexcept; void LogMessage(SQInt32 type, const SQChar * message) noexcept;
/* --------------------------------------------------------------------------------------------
* ...
*/
void VMClose() noexcept;
protected: protected:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------