remove objects

ok I have a class "Bullet" and i want it so that if it hits anything it is removed forever. so in my contact listener i put this:
Code:
var b1:MovieClip = point.shape1.GetBody().GetUserData();
var b2:MovieClip = point.shape2.GetBody().GetUserData();
var norm:b2Vec2 = point.normal;
if(b1 is Bullet)
   main.myWorld.DestroyBody(point.shape1.GetBody());
if(b2 is Bullet)
   main.myWorld.DestroyBody(point.shape2.GetBody());

is this what im supposed to do? because its not working
i looked in the function code and this is whats stopping me
Code:
if (m_lock == true)
{
   return;
}

am i just calling it at the wrong time?
ok i'm calling the function somewhere else and its not locked there. but now im having other problems
i made an array and when i want to destroy a body i add it to the list, then on the update function i delete it. and not only does it not delete it but it is still decrementing the bodycount while the contact listener is still handling collisions from it, adding it to the list, and getting a negative bodycount.

what am i doing...
Hehe, yeah, that's right, you cannot destroy or create bodys in the ContactListener call, however you can create/destroy joints 😆 There's might be some bug.

Show us your code! Not full, just pieces where you create an array and add bodies there!
Try this

Original thread: https://box2d.org/forum/viewtopic.php?t=2190