Fix compile error for two phase lookup

This commit is contained in:
Vinnie Falco
2013-07-05 07:56:51 -07:00
parent 34f4b3cad4
commit 941ac2ae5e
2 changed files with 29 additions and 19 deletions

View File

@@ -89,6 +89,31 @@ void LeakCheckedBase::CounterBase::checkForLeaks ()
//------------------------------------------------------------------------------
void LeakCheckedBase::reportDanglingPointer (char const* objectName)
{
/* If you hit this, then you've managed to delete more instances
of this class than you've created. That indicates that you're
deleting some dangling pointers.
Note that although this assertion will have been triggered
during a destructor, it might not be this particular deletion
that's at fault - the incorrect one may have happened at an
earlier point in the program, and simply not been detected
until now.
Most errors like this are caused by using old-fashioned,
non-RAII techniques for your object management. Tut, tut.
Always, always use ScopedPointers, OwnedArrays,
ReferenceCountedObjects, etc, and avoid the 'delete' operator
at all costs!
*/
DBG ("Dangling pointer deletion: " << objectName);
bassertfalse;
}
//------------------------------------------------------------------------------
void LeakCheckedBase::checkForLeaks ()
{
CounterBase::Singleton::getInstance ().checkForLeaks ();

View File

@@ -58,6 +58,9 @@ protected:
Atomic <int> m_count;
};
protected:
static void reportDanglingPointer (char const* objectName);
private:
friend class PerformedAtExit::ExitHook;
@@ -89,25 +92,7 @@ protected:
{
if (getCounter ().decrement () < 0)
{
/* If you hit this, then you've managed to delete more instances
of this class than you've created. That indicates that you're
deleting some dangling pointers.
Note that although this assertion will have been triggered
during a destructor, it might not be this particular deletion
that's at fault - the incorrect one may have happened at an
earlier point in the program, and simply not been detected
until now.
Most errors like this are caused by using old-fashioned,
non-RAII techniques for your object management. Tut, tut.
Always, always use ScopedPointers, OwnedArrays,
ReferenceCountedObjects, etc, and avoid the 'delete' operator
at all costs!
*/
DBG ("Dangling pointer deletion: " << getLeakCheckedName ());
bassertfalse;
reportDanglingPointer (getLeakCheckedName ());
}
}