mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +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 ()
|
void LeakCheckedBase::checkForLeaks ()
|
||||||
{
|
{
|
||||||
CounterBase::Singleton::getInstance ().checkForLeaks ();
|
CounterBase::Singleton::getInstance ().checkForLeaks ();
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ protected:
|
|||||||
Atomic <int> m_count;
|
Atomic <int> m_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void reportDanglingPointer (char const* objectName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PerformedAtExit::ExitHook;
|
friend class PerformedAtExit::ExitHook;
|
||||||
|
|
||||||
@@ -89,25 +92,7 @@ protected:
|
|||||||
{
|
{
|
||||||
if (getCounter ().decrement () < 0)
|
if (getCounter ().decrement () < 0)
|
||||||
{
|
{
|
||||||
/* If you hit this, then you've managed to delete more instances
|
reportDanglingPointer (getLeakCheckedName ());
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user