[vtkusers] RE: User-defined ExitMethod to close an interactive vtk model by breaking threads to vtkRenderWindowInteractor and vtkRenderWindow gives Segmentation Fault

Anwar Upal upal at me.queensu.ca
Fri Nov 23 18:46:10 EST 2001


Mr. Ramachandran or Other Users:

Using ''this' instead of 'null' as in

	iren->SetExitMethod (ExitMethod, this);

has allowed the member ExitMethod to break the threads to vtkRenderWindow 
and vtkRenderWindowInteractor objects.  As in

   void carpus::MemberExitMethod(void *arg)
   {
     iren->Delete();
     renWindow->Delete();
   }

However instead of returning to the calling function, dbx gave the 
following error when I attempted to exit vtkRenderWindow by pressing q:

         Debug: In vtkObject.cxx, line 246
         vtkObject (0xaf85f8): UnRegistered by NULL, ReferenceCount = -2

         Debug: In vtkObject.cxx, line 109
         vtkObject (0xaf85f8): Destructing!

         Program received signal SIGSEGV, Segmentation fault.
         0xfee477e4 in operator<< () from 
/usr/local/ces/sunos/lib/libVTKCommon.so

Then when I tell the program to single step, gdb says that:

         Single stepping until exit from function __ls__FR7ostreamR9vtkIndent,
         which has no line number information.

         Program terminated with signal SIGSEGV, Segmentation fault.
         The program no longer exists.

 From what I know, I think that the reference count should not be a 
problem, and I cannot figure out where the segmentation fault could be 
coming from and what it's relationship would be to vtkIndent which is used 
to print information.

If you can and would like to help then please reply.

Thanks,
Anwar



At 02:21 AM 11/22/2001 +0530, Mr. Ramachandran wrote:

void ExitMethod(void *arg)
{
   static_cast<carpus*>(arg)->MemberExitMethod(arg);
};

Isnt this obviously wrong?  You are casting a NULL into a carpus*.
This will most definitely cause you lots of grief.  Shouldn;t you
instead do

iren->SetExitMethod (ExitMethod, this);  ???

prabhu




More information about the vtkusers mailing list