NPE in world.renderScene()

Started by rolz, June 19, 2005, 05:07:51 PM

Previous topic - Next topic

rolz

An exception occurs when the world is modified in another thread


java.lang.NullPointerException
at com.threed.jpct.World.renderScene(World.java:788)
at techno.client.engine.TEngine.paintOnce(TEngine.java:181)
at techno.client.engine.TEngine.start(TEngine.java:142)
at techno.client.world3d.Client3D.run(Client3D.java:94)
at techno.client.world3d.Client3D.main(Client3D.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Removing AWT listeners: ...Removing Handlers: ...don



decompiled code:


       int j = objectList.size();
       for(int k = byte0; k < j; k++) {
           Object3D object3d = objectList.elementAt(k);
#788     object3d.object3DRendered = false;
           if(!object3d.isVisible)
               continue;
           int i;
Regards,
Andrei

EgonOlsen

Well, jPCT is not thread safe, so i wouldn't consider this behaviour as a bug. You'll most likely run into trouble like that whenever you are manipulating the world or objects while rendering them.
I suggest to use a kind of queue and process it in the "render"-thread or do the synchronization between your threads yourself (i.e. wait with manipulating the world until the renderScene() has finished).

rolz

Regards,
Andrei