[vtkusers] Breaking GC loops

Kenneth Porter shiva at sewingwitch.com
Thu Feb 18 22:50:30 EST 2010


I added some code to an example using smart pointers to explicitly break a 
GC loop, but it's a hack because it's not exception-safe. What's the 
correct way to break this kind of loop? I see a similar loop between the 
render window and the interactor and there seems to be explicit code in 
vtkRenderWindowInteractor::UnRegister to break this loop. (Why is the break 
condition equal to 3 there? I guess each holds a reference to the other, 
and one holds a reference to itself, and the other has had its reference 
count go to zero pending deletion. But if another object also holds such a 
loop, this won't go to 3.) I think something similar is needed in a custom 
UnRegister method in the example.



More information about the vtkusers mailing list