[vtk-developers] Members of smartpointers as observers
David Doria
daviddoria at gmail.com
Sat Oct 9 09:55:20 EDT 2010
I made an example of the new class member observer functionality:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/ObserverMemberFunction
This worked fine:
MyInteractorStyle* style = MyInteractorStyle::New();
renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,
style, &MyInteractorStyle::KeypressCallbackFunction);
While this produced errors:
vtkSmartPointer<MyInteractorStyle> style2 =
vtkSmartPointer<MyInteractorStyle>::New();
renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,
style2, &MyInteractorStyle::KeypressCallbackFunction);
Is there a way to set a member of a smart pointer to a class as the callback?
Also, if someone wants to add the code for properly handling the
dangling pointers that would be great.
David
More information about the vtk-developers
mailing list