jPCT-AE - a 3d engine for Android > Support

NullPointer in queue

(1/1)

AugTech:
Hi.
I'm getting a reasonably regular, but quite random crash as below. It appears to happen after deleting objects from the world;


--- Code: ---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)

--- End code ---

Any pointers on what I should be looking for/ changing to stop this happening?
Many thanks in advance.

EgonOlsen:
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

AugTech:
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.

EgonOlsen:
Yes, do it in onDrawFrame.

AugTech:
That got it, thank you. Now all removals and additions are done via messages and Stack's

Navigation

[0] Message Index

Go to full version