mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-15 08:35:51 +00:00
Fix compile error for two phase lookup
This commit is contained in:
@@ -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 ();
|
||||
|
||||
@@ -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 ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user