Hi.
I'm getting a reasonably regular, but quite random crash as below. It appears to happen after deleting objects from the world;
09-02 19:13:22.063: I/jPCT-AE(13962): [ 1378145602065 ] - ERROR: Null object in queue...?
09-02 19:13:22.103: W/dalvikvm(13962): threadid=11: thread exiting with uncaught exception (group=0x41050450)
09-02 19:13:22.103: E/AndroidRuntime(13962): FATAL EXCEPTION: GLThread 551
09-02 19:13:22.103: E/AndroidRuntime(13962): java.lang.RuntimeException: [ 1378145602065 ] - ERROR: Null object in queue...?
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.threed.jpct.Logger.log(Logger.java:193)
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.threed.jpct.World.renderScene(World.java:1029)
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.augtech.awilaSDK.graphics.JpctRenderer.onDrawFrame(JpctRenderer.java:162)
09-02 19:13:22.103: E/AndroidRuntime(13962): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
09-02 19:13:22.103: E/AndroidRuntime(13962): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Any pointers on what I should be looking for/ changing to stop this happening?
Many thanks in advance.
In almost all cases, this happens if any other thread than the rendering thread fiddles around with the object list. Like deleting or adding objects in an event listener: http://www.jpct.net/wiki/index.php/Nullpointer_during_rendering_and/or_collision_detection (http://www.jpct.net/wiki/index.php/Nullpointer_during_rendering_and/or_collision_detection)
Okay. So when you say render thread, should this be the onDrawFrame method; i.e. it reads from a synchronized list that has been populated by a Message() to completely detach from the rest of the app? (Object creation in another thread)
Cheers.
Yes, do it in onDrawFrame.
That got it, thank you. Now all removals and additions are done via messages and Stack's