[vtkusers] VTK+JAVA Crash in mouse events
Jeff Lee
jeff at cdnorthamerica.com
Wed Nov 19 07:06:21 EST 2003
>
> Shyam Prakash wrote:
>
>> Jeff,
>> The program that I sent you was just to demonstrate my problem.
>> Your idea of actors getting gc'ed while they are still in renderer could
>> be a possibility. But then I can not convince my self how this could
>> happen as the actor still has a reference to the renderer. Do you have
>> any idea?
>>
>>
> The way you coded it, as I recall, was to assign an ivar called actor
> = new vtkActor() and then added it to the renderer. The next time you
> do this, the previous actor has no more references (even though the
> Renderer in c++ added a consumer, this is not the same as adding a
> reference). Since you added the old one, but did not remove it, the
> object was finalized while still in the renderer, causing the errors.
> In short, the actor doesn't have a reference to the renderer, only a
> list of consumers.
The last part of what I just wrote is plain wrong, the actor does get a
reference when it is added to the renderers list of actors. What really
happened is that you assigned a new actor to the ivar, thus changing all
the existing ones already in the renderer. Without profiling, my guess
is that the renderer kept adding references to the actor ivar, and not
the new actors you were creating. This goes for the mappers too.
-Jeff
More information about the vtkusers
mailing list