BallAndStickFactory incompatibe with GeometryEventMulticaste

Found a bug? Post here.
Post Reply
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

BallAndStickFactory incompatibe with GeometryEventMulticaste

Post by sechel » Tue 26. Oct 2010, 17:03

I'm using a BallAndStickFactory to display some vectors. When I then remove the SceneGraphComponent produced by the Factory from the scene graph I get a

Code: Select all

Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
	at de.jreality.scene.event.GeometryEventMulticaster.remove(
	at de.jreality.scene.event.GeometryEventMulticaster.remove(
	at de.jreality.scene.event.GeometryEventMulticaster.remove(
This I due to the JOGL Renderer that registeres a GeometryListener on every Geometry in the scene graph. This is fine as long as a geometry does not occur to often in the scene graph. Here the result is a chain of GeometryEventMulticasters which is as long the number of occurrences of that specific geometry in the graph. So for the BallAndStickFactory we get a very long chain as it recycles it's tube geometry for every stick.
Any idea how to resove this?

User avatar
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin

Re: BallAndStickFactory incompatibe with GeometryEventMultic

Post by gunn » Sat 26. Nov 2011, 11:29

I would like to bring attention to his bug again. I encounter it regularly with my discrete group software, and it's aggravating.
It looks straightforward to rewrite the code to avoid the stack overflow. Is there any reason not to use a list of some kind to handle the set of geometry listeners (this applies to the other kinds of standard listeners also)? For those interested: look at the code for de.jreality.scene.event.Geometry.addGeometryListener(), for example, as a starting point.
jReality core developer

Post Reply