Error can't remove object

Started by Disastorm, July 21, 2011, 03:21:08 AM

Previous topic - Next topic

Disastorm

Hello, I'm not sure how I got this but I was running my application and I got this can't remove object error:

FATAL EXCEPTION: GLThread 9
RuntimeException ERROR: Can't remove object #218!
at Logger.java:189
at World.removeObject:267
...

*edit I think I may have found what I did wrong, is this the error you get when an object was already removed and you try to remove it again?  I think perhaps my collision listener may have had 2 objects collide at the same time with my object and then what happens is i put my object in a queue to be removed later (during the main thread) so I think maybe it added it twice and tried to remove it twice.  Is this the error I would get in this case?

EgonOlsen

Yes, i think it behaves like that...not sure if this is good or not. Any opinions? Should a remove for an already removed (or never added) object cause an error or should it be silently ignored?

Disastorm

I guess its up to you, it might be good to have a better log message for anyone who does it accidentally though so at least they know what they did wrong.

EgonOlsen

Yes, a better log message might do the trick...