Hello all, it seems that when this is compiled with VS2010, it crashes at the destructor call, as can be seen by the stack dump:
Qt Code:
  1. msvcr100d.dll!operator delete(void * pUserData) Line 52 + 0x51 bytes C++
  2. > testini.exe!QVariant::`scalar deleting destructor'() + 0x46 bytes C++
  3. testini.exe!QList<QVariant>::node_destruct(QList<QVariant>::Node * from, QList<QVariant>::Node * to) Line 418 + 0x3e bytes C++
  4. testini.exe!QList<QVariant>::free(QListData::Data * data) Line 744 C++
  5. testini.exe!QList<QVariant>::~QList<QVariant>() Line 718 C++
  6. testini.exe!WzConfig::vector2i(const QString & name) Line 65 + 0x1d bytes C++
  7. testini.exe!main(int argc, char * * argv) Line 82 + 0x31 bytes C++
To copy to clipboard, switch view to plain text mode 

The code in question looks like (it crashes on exit of this function):
Qt Code:
  1. Vector2i WzConfig::vector2i(const QString &name)
  2. {
  3. Vector2i r;
  4. ASSERT_OR_RETURN(r, contains(name), "Missing %s", name.toUtf8().constData());
  5. QVariantList v = value(name).toList();
  6. ASSERT(v.size() == 2, "Bad list of %s", name.toUtf8().constData());
  7. r.x = v[0].toInt();
  8. r.y = v[1].toInt();
  9. return r;
  10. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QCoreApplication a(argc, argv);
  4.  
  5. {
  6. WzConfig ini("test.ini");
  7. ini.setVector2i("test", Vector2i(1, 2));
  8. ini.setVector3i("test2", Vector3i(1, 2, 3));
  9. ini.setVector3f("test3", Vector3f(1, 2, 3));
  10. ini.setVector3f("test3", Vector3i(1, 2, 3));
  11. ini.setVector3i("test3", Rotation(1, 2, 3));
  12. }
  13. {
  14. WzConfig ini("test.ini");
  15. Vector2i v = ini.vector2i("test");
  16. qWarning("x = %d, y = %d", v.x, v.y);
  17. }
  18.  
  19. return 0;
  20. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. struct Vector2i
  2. {
  3. Vector2i() {}
  4. Vector2i(int x, int y) : x(x), y(y) {}
  5.  
  6. int x, y;
  7. };
  8.  
  9.  
  10. class WzConfig : public QSettings
  11. {
  12. Q_OBJECT
  13.  
  14. public:
  15. WzConfig(const QString &name, QObject *parent = 0) : QSettings(QString("test.ini"), QSettings::IniFormat, parent) { Q_UNUSED(name); }
  16. Vector3f vector3f(const QString &name);
  17. void setVector3f(const QString &name, const Vector3f &v);
  18. Vector3i vector3i(const QString &name);
  19. void setVector3i(const QString &name, const Vector3i &v);
  20. Vector2i vector2i(const QString &name);
  21. void setVector2i(const QString &name, const Vector2i &v);
  22. };
To copy to clipboard, switch view to plain text mode 

Does anyone know if this is a Qt bug (version 4.7.2) or is this a compiler bug (VS 2k10)--it don't seem to crash on linux, or are we doing something wrong ?
Note: VS2k10 was used to compile 4.7.2 libs, since that isn't made available yet on Qt's main site)

Thanks for the info.