There is only one thing : run your program under valgrind, and fix all problems you find.
Up vote 0 down vote favorite share g+ share fb share tw.
I found information from this thread and am starting to wonder if the information provided there is relevant to the cause of the issue I'm facing. The QMap takes the following template arguments: QMap My main issue is that I'm initializing a cube class, and within that class contains various calls which are supposed to do very specific things. One in particular revolves around setting up the class' QMap members.
Observe the following: mGeometry = new Geometry; mGeometry->Init(); mCamera = QVector3D( 10.0, 10.0, 10.0 ); mCubeage. Insert( "cubes", 0 ); Debug Output from mCubeage. Insert( "cubes", 0 ); // ASCII compatibility 1) (uh oh) #ifndef QT_NO_CAST_FROM_ASCII inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch)) {} 2) template Q_INLINE_TEMPLATE typename QMap::iterator QMap::insert(const Key &akey, const T &avalue) { detach(); //the called function QMapData::Node *updateQMapData::LastLevel + 1; QMapData::Node *node = mutableFindNode(update, akey); if (node == e) { node = node_create(d, update, akey, avalue); } else { concrete(node)->value = avalue; } return iterator(node); } 3) bool operator==(const QMap &other) const; inline bool operator!
=(const QMap &other) const { return!(*this == other); } inline int size() const { return d->size; } inline bool isEmpty() const { return d->size == 0; } inline void detach() { if (d->ref! = 1) detach_helper(); } //the called function/if statement inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } inline bool isSharedWith(const QMap &other) const { return d == other. D; } inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; } inline bool operator!
=(int value) const { return _q_value! = value; } 4) inline bool operator! =(int value) const { return _q_value!
= value; } And...that's where it stops - BOOM, segmentation fault. According to some of the Qt forums out there - in the realm of Internet - it is unwise to declare pointers to QMaps, which I originally thought of doing mainly because of the fact that one possible reason for this happening could be due to the fact that the QMap may not have been initialized properly. Yet, the fact that it's a class member which has a default constructor I believe contradicts this.
Question According to the above, why is this happening? What can be done about it? Thoughts Before someone mentions the fact that I'm passing a const char* to a QString parameter, I should note that I have already tried declaring a QString and passing it that as an argument.
I should also probably note that I'm running this from Ubuntu 11.10, in Qt Creator. C++ linux qt segmentation-fault link|improve this question asked Jan 20 at 5:28Holland1,05819 76% accept rate.
– Neox Jan 20 at 6:40 Yup. Although I've switched that to a pointer to a QMap now, mainly due to the fact that I got a heap allocation warning via Valgrind. According to James Mcneallis (if that's how you spell his name), you don't need to initialize objects allocated on the stack (if they're class members), so, I didn't initialize them.
But, Valgrind gave me warnings about this, so I just decided to make a bunch of my class members pointers, and therefore have been working on the memory management since. – Holland Jan 20 at 19:54.
There is only one thing : run your program under valgrind, and fix all problems you find. Why is it happening?!? Who knows?
You didn't provide enough information. Maybe stack smash, maybe you overwrote passed the end of some arrays, etc.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.