precondition:
static QHash<SomeQObject *, QString> s_register;
SomeQObject::~SomeQObject()
{
s_register.remove(this);
}
static QHash<SomeQObject *, QString> s_register;
SomeQObject::~SomeQObject()
{
s_register.remove(this);
}
To copy to clipboard, switch view to plain text mode
if the deconstructor is called during program shutdown there happens a crash in the QHash detach helper (in line 10); the object is valid at the time when "remove" is called, but the key below is now apparently a null pointer...
template <class Key, class T>
struct QHashNode
{
QHashNode *next;
uint h;
Key key;
T value;
inline QHashNode(const Key &key0) : key(key0) {} // ### remove in 5.0
inline QHashNode(const Key &key0, const T &value0) : key(key0), value(value0) {}
inline bool same_key(uint h0, const Key &key0) { return h0 == h && key0 == key; }
};
template <class Key, class T>
struct QHashNode
{
QHashNode *next;
uint h;
Key key;
T value;
inline QHashNode(const Key &key0) : key(key0) {} // ### remove in 5.0
inline QHashNode(const Key &key0, const T &value0) : key(key0), value(value0) {}
inline bool same_key(uint h0, const Key &key0) { return h0 == h && key0 == key; }
};
To copy to clipboard, switch view to plain text mode
this crash happens not when the deconstructor is explicitly called otherwise, it also does not happen if i use a QMap instead a QHash (what is not a big problem fortunately) - any ideas what may cause this???
Bookmarks