sourcehook/sourcehook_impl.h
changeset 181 50e55881d8c2
parent 179 3ade923f508b
child 233 6d19421c552c
     1.1 --- a/sourcehook/sourcehook_impl.h	Thu Feb 09 06:55:02 2006 +0000
     1.2 +++ b/sourcehook/sourcehook_impl.h	Thu Feb 09 08:34:31 2006 +0000
     1.3 @@ -154,25 +154,34 @@
     1.4  	private:
     1.5  		class CProto
     1.6  		{
     1.7 -			const char *m_Proto;
     1.8 +			char *m_Proto;
     1.9  
    1.10  			static bool Equal(const char *p1, const char *p2);
    1.11 +			char *DupProto(const char *src);
    1.12 +			void FreeProto(char *prot);
    1.13  		public:
    1.14 -			CProto(const char *szProto) : m_Proto(szProto)
    1.15 +			CProto(const char *szProto) : m_Proto(DupProto(szProto))
    1.16  			{
    1.17  			}
    1.18  
    1.19 -			CProto(const CProto &other) : m_Proto(other.m_Proto)
    1.20 +			CProto(const CProto &other) : m_Proto(DupProto(other.m_Proto))
    1.21  			{
    1.22  			}
    1.23  
    1.24 +			~CProto()
    1.25 +			{
    1.26 +				FreeProto(m_Proto);
    1.27 +				m_Proto = NULL;
    1.28 +			}
    1.29 +
    1.30  			void operator = (const char *szProto)
    1.31  			{
    1.32 -				m_Proto = szProto;
    1.33 +				m_Proto = DupProto(szProto);
    1.34  			}
    1.35 +
    1.36  			void operator = (const CProto &other)
    1.37  			{
    1.38 -				m_Proto = other.m_Proto;
    1.39 +				m_Proto = DupProto(other.m_Proto);
    1.40  			}
    1.41  
    1.42  			bool operator == (const char *szProto) const