I want to wrote this tip down for me,to find it when i forget the details and for others that are searcing for it.
So if you are using STL containers like a vector,some strange errors errors can appear if you use an out of range index to the container. If you use .at() method then you are safe ,but you used [] in a lot of places and you can use the flag -D_GLIBCXX_DEBUG to use a safe STL container that will check and will find this errors.
The problem with this errors is theat the program will crash usualy in other place not in the place were the bug is. In my case the program crashed in the ~vector destructor. Read on google about using this flags have some problems(the important one is that you must rebuild all the parts that interoperate with STL containers).
To add this flag in a Qt project you need to add this line in the .pro file
QMAKE_CXXFLAGS +=-D_GLIBCXX_DEBUG1