It does do exactly that. But you also call resize(10), which changes the vector to have 10 elements, and since you only had 10 capacity, it's full up again.
Ahh okay, but when I remove the resize(10) I still get the crash, so I am a bit confused now...
I thought this sort of thing would be quite common in C++ so am surprised at this behavior!
Documentation of std::vector will point out that element insertion invalidates iterators.
It looks like this vector is a primary owner for these objects. If you can ensure that the vector outlives anything that may refer to its contents then you could just use std::vector<Test1> and then take references to elements or (preferably) simply refer to them directly as needed. If you're thinking about polymorphism then that won't work though.
The actual situation in my game needs polymorphism, thanks though!
Thanks everyone for your input I am learning a lot!