Hi Laurentiu,
it can be an issue with the
this->ImplicitFunction
object, being handled incorrectly memory-wise. It's hard to understand what the
problem is without looking at the code.
In general, you should set objects from outside using
yourInstance->SetImplicitFunction(anImplicitFunction);
and you declare your setter method in the .h file using the macro
vtkSetObjectMacro(ImplicitFunction,vtkImplicitFunction);
Note that for this to work you have to
#include "vtkImplicitFunction.h" in the .h file (there are other ways to avoid
this but let's make it simpler).
Going through the setter will make the reference count for ImplicitFunction
increase by one (meaning that the object
now knows that there's a class using it, and that a subsequent call to Delete()
doesn't have to deallocate it, but just
decrease the reference count. When the reference count reaches zero, then the
object is deallocated).
If you use SetImplicitFunction to assign a value to the ImplicitFunction
instance variable, then in the destructor do the
following:
if (this->ImplicitFunction) {
this->ImplicitFunction->Delete();
this->ImplicitFunction = NULL;
}
This is important because just setting it to NULL will not deallocate it and
you'll get a memory leak.
Hope this gives you a hint in the right direction.
Best regards
Luca
On Nov 9, 2011, at 3:26 PM, Lipsa Laurentiu Mihai wrote:
> Hi Luca,
>
> Thanks, it works but after I execute my class I have the next . I thing
> that something else it's missing in my c++ or .h file. In my constructor and
> destructor I don't have anything...can be this the problem? I didn't change
> anything in this files .
>
> ERROR: In /home/lau/vmtk-build/VTK/Common/vtkObject.cxx, line 160
> vtkObject (0xbf9bcbac): Trying to delete object with non-zero reference count.
>
> Generic Warning: In /home/lau/vmtk-build/VTK/Common/vtkObjectBase.cxx, line 86
> Trying to delete object with non-zero reference count.
>
> Done executing .
> Output members:
> Id = 0
>
> Best regards.
> Laurentiu
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1_______________________________________________
> vmtk-users mailing list
> vmtk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vmtk-users
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users