我在我的对象中使用构建QList :
QList<clsXMLnode*> mlstChildren;在我的方法来追加一个子节点:
void clsXMLnode::appendChild(clsXMLnode* pobjChild) { assert(pobjChild != NULL); mlstChildren.append(pobjChild); // ...当我使用调试器单步执行时,我可以看到pobjChild具有它应该与之关联的所有静态数据,但是附加到'mlstChildren'的节点没有任何静态成员。 使用调试器,我可以看到'pobjChild'仍然是正确的,而'mlstChildren',虽然它具有相同的子节点指针地址,但它的内容与'pobjChild'的内容不匹配,为什么?
编辑: 它似乎是调试器中的一个错误,我修改了我的appendChild方法,如下所示:
void clsXMLnode::appendChild(clsXMLnode* pobjChild) { assert(pobjChild != NULL); int intNewIdx = mlstChildren.length(); mlstChildren.append(pobjChild); clsXMLnode* pobjCheck = mlstChildren.at(intNewIdx); // ...我可以在调试器中看到pobjCheck的内容与pobjCheck的内容完全匹配,并且所有静态成员都是完整的,但是如果我在调试器中展开mlstChildren ,而类地址匹配pobjChild ,则静态数据的内容不会。
I'm using building a QList in my object:
QList<clsXMLnode*> mlstChildren;In my method to append a child node:
void clsXMLnode::appendChild(clsXMLnode* pobjChild) { assert(pobjChild != NULL); mlstChildren.append(pobjChild); // ...When I use the debugger to single step I can see that pobjChild has all the static data that it should have associated with it, however the node that is appended to 'mlstChildren' has none of the static members. Using the debugger I can see the 'pobjChild' is still correct and 'mlstChildren' whilst it has the same pointer address for the child node, the contents of it do not match the contents of 'pobjChild', why?
Edit: It seems to be a bug in the debugger, I modified my appendChild method as follows:
void clsXMLnode::appendChild(clsXMLnode* pobjChild) { assert(pobjChild != NULL); int intNewIdx = mlstChildren.length(); mlstChildren.append(pobjChild); clsXMLnode* pobjCheck = mlstChildren.at(intNewIdx); // ...I can see in the debugger that the contents of pobjCheck matches the contents of pobjChild exactly and all static members are intact, but if I expand mlstChildren in the debugger, whilst the class address matches pobjChild, the contents of the static data does not.
最满意答案
这不是一个真正的答案,但是我认为我已经证明它是Qt调试器中的几个正在出现的错误之一,我已经向Qt开发人员论坛报告了这个错误:
https://forum.qt.io/topic/82279/debugger-and-static-data
This isn't really an answer, however I think I've proven that it is one of several ongoing bugs in the Qt Debugger, which I have reported to the Qt developers forum:
https://forum.qt.io/topic/82279/debugger-and-static-data
更多推荐
发布评论