L
L
luzhskij2015-06-01 17:27:41
Qt
luzhskij, 2015-06-01 17:27:41

Why Debug Assertion Failed?

I am parsing some xml file.

bool function::test_xml()
{
...
const QString &fileName = "read.xml";
  QFile file(fileName);
  if (!file.open(QFile::ReadOnly | QFile::Text)) 
  {
    qDebug() << "Error: Cannot read file " << fileName << ": " << file.errorString();
    return false;
  }
  QString errorStr;
  int errorLine;
  int errorColumn;
  QDomDocument doc;
  if (!doc.setContent(&file, false, &errorStr, &errorLine,&errorColumn)) 
  {
    qDebug() << "Error: Parse error at line " << errorLine << ", " << "column " << errorColumn << ": " << errorStr;
    return false;
  }
...
  return true;
}

At the exit from the function, the program falls into "_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)".
Why this happens is unclear.
A similar example in Jasmine Blanchett's book, Mark Summerfield works fine.
windows7x64, visual studio 2010, qt4.8

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2015-06-01
@luzhskij

By eye in the code of errors in work with memory it is not visible. I can suggest once again to carefully check whether the correct libraries are being used. Libraries must match the compiler version and runtime, the bitness of the built executable and the build configuration (debug/release). Check if everything is connected correctly. A lot of strange floating errors can appear if, for example, a kit is built for the 2010 studio, but is used in a project with a compiler from 2013 and vice versa.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question