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:
parent
a2a02a6c9d
commit
d937be3e37
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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:
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user