[mapguide-commits] r4486 - trunk/MgDev/Common/Foundation/System
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Jan 7 01:18:51 EST 2010
Author: waltweltonlair
Date: 2010-01-07 01:18:50 -0500 (Thu, 07 Jan 2010)
New Revision: 4486
Modified:
trunk/MgDev/Common/Foundation/System/Disposable.cpp
trunk/MgDev/Common/Foundation/System/Disposable.h
trunk/MgDev/Common/Foundation/System/GuardDisposable.cpp
Log:
Just minor cleanup to MgDisposable / MgGuardDisposable class:
* add missing method descriptions
* move implementations from header file to source file
* warn if refcount is <= 0 in Release method (not just when equal to 0)
Modified: trunk/MgDev/Common/Foundation/System/Disposable.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/System/Disposable.cpp 2010-01-06 08:36:56 UTC (rev 4485)
+++ trunk/MgDev/Common/Foundation/System/Disposable.cpp 2010-01-07 06:18:50 UTC (rev 4486)
@@ -85,10 +85,10 @@
m_refCountFlag = true;
- if (0 == m_refCount)
+ if (0 >= m_refCount)
{
#ifdef _DEBUG
- ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) ************ Error in MgDisposable::Release(). Class Name: %W. Called with Reference Count = 0.\n"), GetClassName().c_str()));
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) ************ Error in MgDisposable::Release(). Class Name: %W. Called with Reference Count <= 0.\n"), GetClassName().c_str()));
#endif
throw new MgLogicException(L"MgDisposable.Release", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -109,6 +109,20 @@
//////////////////////////////////////////////////////////////
+void MgDisposable::SetRefCountFlag()
+{
+ m_refCountFlag = true;
+}
+
+
+//////////////////////////////////////////////////////////////
+void MgDisposable::ResetRefCountFlag()
+{
+ m_refCountFlag = false;
+}
+
+
+//////////////////////////////////////////////////////////////
MgDisposable::MgDisposable() :
m_refCount(1),
m_refCountFlag(false)
@@ -120,7 +134,7 @@
MgDisposable::~MgDisposable()
{
#ifdef _DEBUG
- if ((m_refCountFlag) && (m_refCount != 0))
+ if ((m_refCountFlag) && (m_refCount != 0))
{
ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) ************ Error in MgDisposable::~MgDisposable(). Class Name: %W. Actual Reference Count: %d. Expected Reference Count: 0. This object should have been created on the heap instead of on the stack.\n"), GetClassName().c_str(), m_refCount));
}
Modified: trunk/MgDev/Common/Foundation/System/Disposable.h
===================================================================
--- trunk/MgDev/Common/Foundation/System/Disposable.h 2010-01-06 08:36:56 UTC (rev 4485)
+++ trunk/MgDev/Common/Foundation/System/Disposable.h 2010-01-07 06:18:50 UTC (rev 4486)
@@ -72,13 +72,15 @@
///
virtual INT32 Release();
-INTERNAL_API:
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Sets the ref count flag for this object to true.
+ ///
+ /// \return
+ /// Returns nothing
+ ///
+ void SetRefCountFlag();
- void SetRefCountFlag()
- {
- m_refCountFlag = true;
- }
-
protected:
//////////////////////////////////////////////////////////////////
@@ -99,10 +101,14 @@
///
virtual void Dispose() = 0;
- void ResetRefCountFlag()
- {
- m_refCountFlag = false;
- }
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Resets the ref count flag for this object to false.
+ ///
+ /// \return
+ /// Returns nothing
+ ///
+ void ResetRefCountFlag();
private:
Modified: trunk/MgDev/Common/Foundation/System/GuardDisposable.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/System/GuardDisposable.cpp 2010-01-06 08:36:56 UTC (rev 4485)
+++ trunk/MgDev/Common/Foundation/System/GuardDisposable.cpp 2010-01-07 06:18:50 UTC (rev 4486)
@@ -52,12 +52,13 @@
{
{
ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, -1));
+
m_refCountFlag = true;
- if (0 == m_refCount)
+ if (0 >= m_refCount)
{
#ifdef _DEBUG
- ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) ************ Error in MgGuardDisposable::Release(). Class Name: %W. Called with Reference Count = 0.\n"), GetClassName().c_str()));
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) ************ Error in MgGuardDisposable::Release(). Class Name: %W. Called with Reference Count <= 0.\n"), GetClassName().c_str()));
#endif
throw new MgLogicException(L"MgGuardDisposable.Release", __LINE__, __WFILE__, NULL, L"", NULL);
More information about the mapguide-commits
mailing list