Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Crash in QVariantMap/QVariantList destructor



  • Hallo folks,

    I recently built up a structure using QVariantMaps and QVariantLists to convert it to JSON afterwards.
    But I experienced a strange behaviour when leaving the function and the destructor of this structure has been called.

    It looked like this:
    @QVariantMap outerMap;
    QVariantList outerList;
    QVariantMap innerMap;
    QVariantList innerList;

    innerList.append("foo");
    innerMap.insert("test", innerList);
    outerList.append(innerMap);
    outerMap.insert("test1", outerList);@

    If I replace the innerList with another QVariantMap or anything else, it workes fine. Is this a problem on my side or is this a bug in Qt? I also tried to clear all QVariantMaps and QVariantLists myself starting from the inner to outer before I delete them, but the same problems comes up..

    Any ideas? ;)



  • I cannot reproduce a crash. Can you provide us a complete test case please?



  • Hmm,

    I am using VisualStudio to compile my project and to reproduce the crash.
    If I try the same in QtCreator, everything works fine.
    Both are using Qt 4.6, what could be the difference?



  • Is QtCreator using MSVC too - or is it using the MinGW toolchain?



  • It is using MSVC++ Toolchain.
    The only difference in the build process is that QtCreator uses JOM and MSVC is configured to use JAM, dont know if this matters.



  • Are you linking with the right version of the Qt libs then? Just checking... I have no idea what else it might be.



  • I am not quite sure..
    I told JAM where to find the Qt libs for MSVC and always use the debug libs.
    How can I check if the linked libs are correct?



  • Mixing wrong DLLs can lead to that effect.

    The "Dependency Walker":http://www.dependencywalker.com/ shows you the loaded (or missing) DLLs. Be aware, that it shows different results than using it from within the IDE, as the latter may have manipulated the search PATH.


Log in to reply