Qt堆内存损坏 [英] Qt heap memory corruption
问题描述
我正在编写Qt 4.6应用程序(没有qt设计器),并且当我关闭程序时,我从Visual Studio中收到此错误:
I'm writing a Qt 4.6 application (without the qt designer) and when I close the program I get this error from Visual Studio:
Windows已在以下位置触发断点Test.exe.
Windows has triggered a breakpoint in Test.exe.
这可能是由于堆,表明存在错误Test.exe或它具有的任何DLL加载.
This may be due to a corruption of the heap, which indicates a bug in Test.exe or any of the DLLs it has loaded.
这也可能是由于用户在Test.exe具有焦点的情况下按F12.
This may also be due to the user pressing F12 while Test.exe has focus.
输出窗口可能有更多诊断信息.
The output window may have more diagnostic information.
这是源代码:
-
Main.cpp
http://pastebin.com/DeUvZSHU -
TesterWindow.h
http://pastebin.com/SEVr8x40 -
TesterWindow.cpp
http://pastebin.com/MYUtZZGw -
Device.h
http://pastebin.com/bXKxVrmW -
Device.cpp
http://pastebin.com/H1kMcRes -
ExtWiiMote.h
http://pastebin.com/uX3HT9Yw -
ExtWiiMote.cpp
http://pastebin.com/p2TKZdHv
Main.cpp
http://pastebin.com/DeUvZSHUTesterWindow.h
http://pastebin.com/SEVr8x40TesterWindow.cpp
http://pastebin.com/MYUtZZGwDevice.h
http://pastebin.com/bXKxVrmWDevice.cpp
http://pastebin.com/H1kMcResExtWiiMote.h
http://pastebin.com/uX3HT9YwExtWiiMote.cpp
http://pastebin.com/p2TKZdHv
(您无法编译,我无法共享使用的库)
(You can't compile it, I can't share the used library)
怎么了?
推荐答案
在您声明的 ExtWiiMote.h
中
QLabel* dots[3][3];
,在 ExtWiiMote.cpp
中,您使用 dots [3] [0] ...
.
修正点
数组的大小,可能会没事的.
Fix dots
array size and probably you'll be fine.
这篇关于Qt堆内存损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!