philippeback / java-universal-tween-engine

Automatically exported from code.google.com/p/java-universal-tween-engine
0 stars 0 forks source link

TweenManager.getTimelinesCount getting exception #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create Several Object to be tweened
2. call TweenManager.getRunningTimelinesCount() before every tween creating( 
this must happen even during animations)
3. Keep doing animation until the exception happens

What is the expected output? What do you see instead?

We receive a array out of bounds exception during 
tweenManager.getRunningTimelinesCount().

What version of the product are you using? On what operating system?
6.3.3 on Android

Please provide any additional information below.

The method have this line of code:
"for (int i=0, n=objs.size(); i<n; i++)"
But during the for loop, it seems that an Tween has ended and are removed from 
the "objs" array, causing the array out of bounds.

Original issue reported on code.google.com by paulovic...@gmail.com on 31 Aug 2012 at 12:58

GoogleCodeExporter commented 8 years ago
Forgot to say the Auto Remove was enabled!

Original comment by paulovic...@gmail.com on 31 Aug 2012 at 1:00

GoogleCodeExporter commented 8 years ago
Issue 12 has been merged into this issue.

Original comment by aurelien.ribon on 31 Aug 2012 at 1:01

GoogleCodeExporter commented 8 years ago
Wow, this is really strange. Sounds like a concurrency issue to me. Do you 
update the manager in the same thread as the one in which you call 
getRunningTimelinesCount()?

Original comment by aurelien.ribon on 31 Aug 2012 at 1:03

GoogleCodeExporter commented 8 years ago
No. you're right, that is the problem. We are creating the Tween in the main 
thread and updating in a rendering thread.

Original comment by paulovic...@gmail.com on 31 Aug 2012 at 1:11

GoogleCodeExporter commented 8 years ago
Glad you solved your issue :)

Original comment by aurelien.ribon on 31 Aug 2012 at 1:14

GoogleCodeExporter commented 8 years ago
Don't know if this is the right place to ask, but what is the best approach to 
avoid this concurrency problems in your engine. I have a main thread that 
create all the tweens and update the objects and a redering thread that calls 
TweenManage.update() and draws all the objects.

Original comment by paulovic...@gmail.com on 31 Aug 2012 at 1:17

GoogleCodeExporter commented 8 years ago
Are you speaking about a native android application or a game? In either way, 
what do you call a "main thread"? Android applications entry point is the 
"onCreate()" method, which already runs in the rendering thread. Do you create 
another thread in there?

Btw, if you need to paste code or if you want a better place to discuss this, 
see the forum: http://www.aurelienribon.com/forum/ Issue reports are quite 
limited :p

Original comment by aurelien.ribon on 31 Aug 2012 at 1:25

GoogleCodeExporter commented 8 years ago
Thank you, i just did that!

Original comment by paulovic...@gmail.com on 31 Aug 2012 at 1:49