Author Topic: NullPointer in queue  (Read 767 times)

Offline AugTech

  • int
  • **
  • Posts: 64
    • View Profile
    • Augmented Technologies
NullPointer in queue
« on: September 02, 2013, 08:53:58 pm »
Hi.
I'm getting a reasonably regular, but quite random crash as below. It appears to happen after deleting objects from the world;

Code: [Select]
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: NullPointer in queue
« Reply #1 on: September 02, 2013, 09:17:41 pm »
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

Offline AugTech

  • int
  • **
  • Posts: 64
    • View Profile
    • Augmented Technologies
Re: NullPointer in queue
« Reply #2 on: September 03, 2013, 09:51:59 am »
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.
« Last Edit: September 03, 2013, 10:05:42 am by AugTech »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: NullPointer in queue
« Reply #3 on: September 03, 2013, 10:23:34 am »
Yes, do it in onDrawFrame.

Offline AugTech

  • int
  • **
  • Posts: 64
    • View Profile
    • Augmented Technologies
Re: NullPointer in queue
« Reply #4 on: September 05, 2013, 07:53:30 pm »
That got it, thank you. Now all removals and additions are done via messages and Stack's