precondition:

Qt Code:
  1. static QHash<SomeQObject *, QString> s_register;
  2.  
  3. SomeQObject::~SomeQObject()
  4. {
  5. s_register.remove(this);
  6. }
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...

Qt Code:
  1. template <class Key, class T>
  2. struct QHashNode
  3. {
  4. QHashNode *next;
  5. uint h;
  6. Key key;
  7. T value;
  8.  
  9. inline QHashNode(const Key &key0) : key(key0) {} // ### remove in 5.0
  10. inline QHashNode(const Key &key0, const T &value0) : key(key0), value(value0) {}
  11. inline bool same_key(uint h0, const Key &key0) { return h0 == h && key0 == key; }
  12. };
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???