[vtkusers] How to delete an interactorstyle in runtime?

David Doria daviddoria+vtk at gmail.com
Fri Mar 5 09:18:39 EST 2010


On Fri, Mar 5, 2010 at 9:04 AM, sercani <sercanimailgroups at gmail.com> wrote:

> Hi everyone,
> I've written subclass of vtkInteractorStyleImage and set it to an
> interactor, but i need to set another custom interactorstyle in runtime.
> When i want to delete the current custom interactor style like this:
> if(cis->GetEnabled())
>    {
>        cis->EnabledOff();
>        cis->SetInteractor(0);
>        cis->Delete();
>    }
>
> it throws :
>
> "ERROR: In ..\..\VTK_Source\VTK\Common\vtkObject.cxx, line 160
> vtkObject (0155E128): Trying to delete object with non-zero reference
> count."
>
> How can i delete this custom interactorstyle and set another custom
> interactorstyle as current interactor's new interactorstyle?
>
>
Is cis a smart pointer? If so then you should let it delete itself instead
of deleting it manually - or if you want to delete it manually then don't
use a smart pointer. Can you send us some more code for context?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100305/bad28da8/attachment.htm>


More information about the vtkusers mailing list