Problem with QXML
-
Hello, I have been developing a qt application using msvc2010 and I rebuild qt using this config
configure -platform win32-msvc2010 -debug -opensource -fast -plugin-sql-odbc -plugin-sql-sqlite -no-qt3support -no-dsp -incredibuild-xge -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -webkit -script -scripttools -qt-style-windowsxp -qt-style-windowsvista -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -no-s60 -nomake demos -nomake examples
when I load a xml file, it's ok.
@
QFile file("item.xml");
if (file.open(QIODevice::ReadOnly))
{
QDomDocument doc;
if (doc.setContent(&file))
{
...
}
file.close();
}
@
but I have change the variable QMAKE_CFLAGS_DEBUG from MDd to MTd and the variable QMAKE_CFLAGS_RELEASE from MD to MT in the file "mkspecs/win32-msvc2010/qmake.conf" and rebuild qt again.Then, the code above will crash at doc.setContent(), and I found it crashes at line 1357 on qxml.cpp
@
1353 QXmlInputSource::~QXmlInputSource()
1354 {
1355 // ### Qt 5: close the input device. See task 153111
1356 #ifndef QT_NO_TEXTCODEC
1357 delete d->encMapper;
1358 #endif
1359 delete d;
1360 }
@
Is there something else I need to do, or this is a bug of qt ?Any help?
-
[quote author="Franzk" date="1289283745"]MD is a release mode setting. Use MDd (Multi threaded DLL debug). Don't mix MD and MDd. You'll get crashes.[/quote]
sorry, I made a mistake when I post, I build qt using MT/MTd instead of MD/MDd, and my project uses the same CRT library
-
Then make sure you link to the correct Qt libraries (debug and release libs should not be mixed up).
Also try and find out what part of the delete statement actually causes the crash. Is it using the d pointer or is it actually deleting the member of the d pointer?