[vtkusers] Unhandled exception at the time of Unregistering vtkSmartPointer

cel02000 cel02000 at yahoo.com
Fri Jun 8 18:11:26 EDT 2012


Dear All,

I have a function whose arguments is as follows:
*int Calc(
	vtkSmartPointer< vtkPolyData >& ,
	vtkSmartPointer< vtkDoubleArray >& ,
	vtkSmartPointer< vtkDoubleArray >& ,
	vtkSmartPointer< vtkDoubleArray >& );*

Inside the function I also create three vtkDoubleArrays. The declaration is
by using vtkSmartPointer. When the function does its task and finally
reaches its end and wants to unregister the variables, I get the unhandled
exception:

*Unhandled exception at 0x000007fededc4493 (vtkCommon.dll) in mycode.exe:
0xC0000005: Access violation reading location 0xffffffffffffffff.*

The error occurs at the line: object->UnRegister(0) in the following
destructor:

*vtkSmartPointerBase::~vtkSmartPointerBase()
{
  // The main pointer must be set to NULL before calling UnRegister,
  // so use a local variable to save the pointer.  This is because the
  // garbage collection reference graph traversal may make it back to
  // this smart pointer, and we do not want to include this reference.
  vtkObjectBase* object = this->Object;
  if(object)
    {
    this->Object = 0;
    object->UnRegister(0);
    }
}*

Could someone help me fix this problem?

Thanks.

--
View this message in context: http://vtk.1045678.n5.nabble.com/Unhandled-exception-at-the-time-of-Unregistering-vtkSmartPointer-tp5713691.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list