[vtkusers] iam getting an error saying "trying to delete object with non zero reference count"
david michell
davidmichell at rediffmail.com
Thu Jan 22 08:39:45 EST 2004
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040122/51fe3974/attachment.htm>
-------------- next part --------------
Hello everybody,
Thanks you all for the help you have done for me.
Iam working on a class that uses vtk. the code goes like this
//all tehe #includes are here
class cdraw
{
vtkLineSource **ls;
vtkPolyDataMapper **map;
vtkActor **act;
vtkRenderer *rnd;
vtkRenderWindowInteractor *rwi;
vtkRenderWindow *rw
int count;
public:
cdraw(int cnt)
{
count=cnt;
int i;
ls=new vtkLineSource *[cnt];
act=new vtkActor *[cnt];
map=new vtkPolyDataMapper *[cnt];
rnd=vtkRenderer::New();
for (i=0;i<cnt;i++)
{
ls[i]=vtkLineSource::New();
act[i]=vtkActor::New();
map[i]=vtkPolyDataMapper::New();
ls[i]->SetPoint1((float)i,0.0,0.0);
ls[i]->SetPoint2((float)i,10.0,0.0);
map[i]->SetInput(ls[i]->GetOutput());
act[i]->SetMapper(map[i]);
rnd->AddActor(act[i]);
}
rw=vtkRenderWindow::New();
rw->AddRenderer(rnd);
rwi=vtkRenderWindowInteractor::New();
rwi->SetRenderWindow(rw);
}
void render()
{
rwi->Initialize();
rnd->Render();
rwi->Start();
}
~cdraw()
{
for (i=0;i<cnt;i++)
{
ls[i]->Delete();
act[i]->Delete();
map[i]->Delete();
}
delete[] ls;
delete[] act;
delete[] map;
rnd->Delete();
rwi->Delete();
rw->Delete();
}
};
void main()
{
cdraw *c;
c=new cdraw(5);
c->render();
delete c;
}
when i exit from the code pressing "q" i get a window which displays the message
"trying to delete object with non zero refernce count"
please help
thanking you for the help
david michell
More information about the vtkusers
mailing list