free-language / box2d

Automatically exported from code.google.com/p/box2d
0 stars 0 forks source link

CollisionProcessing demo bug #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start CollisionProcessing demo
2. Press space and launch bomb twice
3.

What is the expected output? What do you see instead?
The second bomb won't appear.

What version of the product are you using? On what operating system?
2.1.0

Please provide any additional information below.
This is because the m_bomb object may be destroyed by Step of 
CollisionProcessing in the code block,
        while (i < nukeCount)
        {
            b2Body* b = nuke[i++];
            while (i < nukeCount && nuke[i] == b)
            {
                ++i;
            }

            m_world->DestroyBody(b);
        }
Solution: change to
        while (i < nukeCount)
        {
            b2Body* b = nuke[i++];
            while (i < nukeCount && nuke[i] == b)
            {
                ++i;
            }
                        if (b != m_bomb0)
                    m_world->DestroyBody(b);
        }

Original issue reported on code.google.com by wqyfavo...@gmail.com on 19 Mar 2010 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by erinca...@gmail.com on 3 Apr 2010 at 6:49