开发者

Visual studio 2008 "Debug Assertion Failed" message while calling QDomElement::text() function

I have included the source, the error and the stack trace. How do I resolve this issue? I need pointers(explanation) on how to proceed regarding this

Source Code :

QFile xmlInputFile(".\\gatewayipmonitor.xml");  
xmlInputFile.open(QIODevice::ReadOnly);

QByteArray xmlData(xmlInputFile.readAll());

QDomDocument doc;
doc.setContent(xmlData);

QDomElement docEl(doc.documentElement());
const QString tagName(docEl.tagName());

docEl.text();

When the last line is executed - I get the message

Windows has triggered a breakpoint in tests.exe.

This may be due to a corruption of the heap, which indicates a bug in tests.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while tests.exe has focus.

The o开发者_如何学运维utput window may have more diagnostic information. "

When I click continue - I further get the message -

Program: ...n\tests\Release\tests.exe File: f:\dd\vctools\crt_bld\self_x86\crt\dbgheap.c

Expression:_CrtIdValidHeapPointer(pUserData)

Stack Trace:

msvcr90d.dll!_free_dbg_nolock(void * pUserData=0x00a5f348, int nBlockUse=1)  Line 1317 + 0x30 bytes C++
msvcr90d.dll!_free_dbg(void * pUserData=0x00a5f348, int nBlockUse=1)  Line 1258 + 0xd bytes C++
msvcr90d.dll!free(void * pUserData=0x00a5f348)  Line 49 + 0xb bytes C++
QtCored4.dll!qFree(void * ptr=0x00a5f348)  Line 60 + 0xa bytes  C++
QtCored4.dll!QString::free(QString::Data * d=0x00a5f348)  Line 1185 + 0x9 bytes C++
QtCored4.dll!QString::~QString()  Line 883 + 0x23 bytes C++
tests.exe!test_GatewayIpMonitor()  Line 321 + 0xc bytes C++
tests.exe!main()  Line 343  C++
tests.exe!__tmainCRTStartup()  Line 586 + 0x17 bytes    C


I was running the program in the release build but linking against debug build libraries(Qtcored.lib). That was the issue.


it's not heap corruption. you're deleting a bad qstring. find out how that qstring instance or pointer(most likely) was used when it was actuallly bad.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜