Removing actors from the scene creates threding problems with Java/VTK/X
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I am creating an interactive GUI for visualising multiple VTK files at one time, in addition different VTK files need to be loaded in and out of the scence.
Whenever I use the VTK methods for removing actors (vtkRenderer.RemoveAllViewProps(), or vtkRenderer.RemoveActor()) on the renderer this will randomly cause a asynchorous crash with the X threading system.
This can be achieved by using the "Clear" or "Add" button in the GUI. It may take one or two adds and clears but eventually a variation of the following message will appear:
Xlib: unexpected async reply (sequence 0x34b1)!
Interestingly when I tried to create a simplified version of the program (without the splash) I could not get this behaviour. So perhaps it is something to do with the splash image.
I was able to resolve this issue by adding two methods to vtkPanel.java which put locks and unlocks around the problematic methods eg:
public void removeProps() { Lock(); ren.RemoveAllViewProps(); UnLock(); }
I am uploading my source and an image that is loaded when run. It also necessary to have some vtk polydata files in order bring them in and out of the scene.
I am also using a slightly old version of X 6.8.2 vs 7.3
cheers,
Henrik