p.push_back(my_str());
in void my_str :: insert()
causes vector reallocation, this
is invalid
x = 123;
BOOM! Heap corruption.
To avoid such problems in future do not edit vectors from objects they contain. Or, if you have to, make sure you do not use object members after this.