Game Development Community

Crash in Vector<T>::push_back

by Ian Omroth Hardingham · in Torque Game Engine · 03/01/2010 (5:18 am) · 2 replies

Hey guys.

Very worrying crash in dRealloc when calling push_back on a vector. This is an intermittent bug. Any advice?

Thanks,
Ian

#1
03/02/2010 (2:09 pm)
Debug it!

I dunno, I've never seen crashes related to vectors unless I'm doing something silly. Any more information you can give us?
#2
03/02/2010 (8:01 pm)
The only time I've seen a problem with Vector::push_back is if the value you are pushing is already in the vector. If the vector memory is resized, the reference passed to push_back is now invalid and you get a crash when trying to assign the new value.