[vtkusers] Unregister(QObjectBase *) vs Delete()

Barth, Sebastian sebastian.barth at iosb.fraunhofer.de
Wed Jun 23 05:38:48 EDT 2010


Hello vtkusers,

I tried to find out what is the difference between Unregister(QObjectBase *) and Delete() - Without success.
Could you please explain?

What I know about reference counting (please correct me):

vtkPolyDataMapper * mapperA = vtkPolyDataMapper::New();	// Reference count of 	mapperA = 1.
vtkPolyDataMapper * mapperB = vtkPolyDataMapper::New();	// Reference count of 	mapperB = 1.

actor->SetMapper(mapperA);						// Reference count of	mapperA = 2 (or maybe more?)
actor->SetMapper(mapperB);						// Reference count of 	mapperA = 1,
										//				mapperB = 2 (or maybe more?)

mapperA->Delete();							// Reference count of 	mapper A - 1 = 0 -> deleted

Is this code above a correct way or is it illegal for the pipeline?
What happens if I call mapperB->Unregister(0) ?
Where is difference between Unregister(..) and Delete()?

Thanks a lot,

Sebastian Barth





More information about the vtkusers mailing list