www.jpct.net

jPCT - a 3d engine for Java => Bugs => Topic started by: rolz on June 19, 2005, 05:07:51 pm

Title: NPE in world.renderScene()
Post by: rolz on June 19, 2005, 05:07:51 pm
An exception occurs when the world is modified in another thread

Code: [Select]

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:

Code: [Select]

        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;
Title: NPE in world.renderScene()
Post by: EgonOlsen on June 20, 2005, 10:15:00 am
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).
Title: NPE in world.renderScene()
Post by: rolz on June 20, 2005, 03:50:37 pm
Ok, got that. Thanks.