gpt4 book ai didi

c++ - 调用 QDomElement::text() 函数时出现 Visual Studio 2008 "Debug Assertion Failed"消息

转载 作者:行者123 更新时间:2023-11-28 08:18:35 26 4
gpt4 key购买 nike

我已经包含了源代码、错误和堆栈跟踪。我该如何解决这个问题?我需要关于如何进行的指示(解释)

源代码:

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();

当最后一行被执行时——我收到消息

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 output window may have more diagnostic information. "

当我点击继续 - 我进一步收到消息 -

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

Expression:_CrtIdValidHeapPointer(pUserData)

堆栈跟踪:

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

最佳答案

我在发布版本中运行该程序,但链接到调试构建库 (Qtcored.lib)。这就是问题所在。

关于c++ - 调用 QDomElement::text() 函数时出现 Visual Studio 2008 "Debug Assertion Failed"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6750424/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com