How do you call your:
bool xml::loadData(const char* fileName, std::vector<Joint> *joints)?
Most likely, "joints" is not initialized.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...
But the problem is not here, the problem stills on the function Joint::addVertex(Vertex &v) (checked with qDebug()) and I don't know why.
Your Joint class is not safely copyable, since it contains a pointer member. You are adding Joint objects by value into a vector, and the vector will make copies.
Code:
std::vector<Joint> *nextJoint;
How do you handle this member when copies are made?
The bottom line is this -- your program is doing pointer manipulations -- if you make one mistake anywhere in your program wth the usage of pointers, this mistake can manifest itself in other parts of your program that may have nothing to do with pointers. Working with pointers isn't a freebie -- you must be aware, at all times, what you're doing and the consequences of such.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; April 19th, 2011 at 01:02 PM.
The error message indicates an illegal memory access, usually caused by the use on an invalid pointer.
Because the vector class stores copies of the elements you add to it, IMO another candidate culprit is a bug in the Vertex copy constructor and/or copy assignment operator (or simply the absence of just that).
Just a qualified guess...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Bookmarks