mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Move the resource releasing from the basic event type to it's destructor.
This commit is contained in:
parent
a2a02a6c9d
commit
d937be3e37
@ -34,16 +34,16 @@ BasicEvent::BasicEvent(SQInt32 type, bool suspended) noexcept
|
||||
, m_Suspended(suspended)
|
||||
{
|
||||
Attach();
|
||||
// Receive notification when the VM is about to be closed to release object references
|
||||
_Core->VMClose.Connect< BasicEvent, &BasicEvent::VMClose >(this);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BasicEvent::~BasicEvent()
|
||||
{
|
||||
Detach();
|
||||
// Stop receiving notification when the VM is about to be closed
|
||||
_Core->VMClose.Disconnect< BasicEvent, &BasicEvent::VMClose >(this);
|
||||
// Release the reference to the specified callback
|
||||
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)
|
||||
{
|
||||
|
@ -757,11 +757,6 @@ public:
|
||||
*/
|
||||
void LogMessage(SQInt32 type, const SQChar * message) noexcept;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
void VMClose() noexcept;
|
||||
|
||||
protected:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user