sourcehook/sourcehook_impl_ciface.h
changeset 491 698397d072e2
parent 381 8eded451c936
child 523 6f1630519b81
     1.1 --- a/sourcehook/sourcehook_impl_ciface.h	Fri Jan 18 16:56:03 2008 +0000
     1.2 +++ b/sourcehook/sourcehook_impl_ciface.h	Fri Jan 18 17:10:54 2008 +0000
     1.3 @@ -31,6 +31,7 @@
     1.4  
     1.5  			// *** Interface ***
     1.6  			inline CIface(void *ptr);
     1.7 +			inline ~CIface();
     1.8  			inline bool operator==(const Descriptor &other);
     1.9  			inline void *GetPtr() const;
    1.10  			inline List<CHook> &GetPreHookList();
    1.11 @@ -45,6 +46,20 @@
    1.12  		{
    1.13  		}
    1.14  
    1.15 +		inline CIface::~CIface()
    1.16 +		{
    1.17 +			// Before getting deleted, delete all remaining hook handlers
    1.18 +			for (List<CHook>::iterator iter = m_PreHooks.begin(); iter != m_PreHooks.end(); ++iter)
    1.19 +			{
    1.20 +				iter->GetHandler()->DeleteThis();
    1.21 +			}
    1.22 +
    1.23 +			for (List<CHook>::iterator iter = m_PostHooks.begin(); iter != m_PostHooks.end(); ++iter)
    1.24 +			{
    1.25 +				iter->GetHandler()->DeleteThis();
    1.26 +			}
    1.27 +		}
    1.28 +
    1.29  		inline bool CIface::operator==(const Descriptor &other)
    1.30  		{
    1.31  			return m_Ptr == other;