I think I'm going to use this method in GLSurfaceView:
* /***
* * Queue a runnable to be run on the GL rendering thread. This can be
used*
* * to communicate with the Renderer on the rendering thread.*
* * Must not be called before a renderer has been set.*
* * @param r the runnable to be run on the GL rendering thread.*
* */*
* public void queueEvent(Runnable r) {*
* mGLThread.queueEvent(r);*
* }*
I'll create a *Runnable* that calls the reset function and pass the *
Runnable* on to queueEvent.
Thanks.
On Wednesday, April 24, 2013 10:26:02 AM UTC-5, bob wrote:
>
> I've been investigating an insidious error in an Android OpenGL game app.
> This error was brought to my attention by ACRA.
>
> I believe that the source of the error is that the code in an onTouchEvent
> executes in a different thread than the code
> in the OpenGL drawing thread.
>
> So, basically, the drawing thread was looping thru some enemy ships trying
> to draw them.
>
> Meanwhile, someone pressed the reset button on the game (an onTouchEvent),
> and the enemy ship LinkedList got cleared. This clearing occurred while
> the drawing thread was looping thru them. Thus an
> IndexOutOfBoundsException occurred.
>
> Anyhow, I guess my question is... how would the professional Android
> developer have prevented this?
>
> Thanks.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.