Commit 80361064 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Added further error messages to reference counting.

parent bfe9f192
......@@ -54,6 +54,10 @@ vtkRefCount::~vtkRefCount()
// Increase the reference count (mark as used by another object).
void vtkRefCount::Register(vtkObject* o)
{
if ( this->ReferenceCounting == 0 )
{
vtkErrorMacro(<<"Attempting to Register an object which has reference counting turned off.");
}
this->RefCount++;
vtkDebugMacro(<< "Registered by " << o->GetClassName() << " (" << o << ")");
}
......@@ -62,6 +66,11 @@ void vtkRefCount::Register(vtkObject* o)
// Decrease the reference count (release by another object).
void vtkRefCount::UnRegister(vtkObject* o)
{
if ( this->ReferenceCounting == 0 )
{
vtkErrorMacro(<<"Attempting to UnRegister an object which has reference counting turned off.");
}
vtkDebugMacro(<< "UnRegistered by " <<o->GetClassName() << " (" << 0 << ")");
if (--this->RefCount <= 0) delete this;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment