我正在编写一个 Qt 4.6 应用程序(没有 qt 设计器),当我关闭该程序时,我从 Visual Studio 收到此错误:
Windows has triggered a breakpoint in Test.exe.
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.
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/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
(你编译不了,我没法分享用过的库)
怎么了?
最佳答案
在 ExtWiiMote.h
中你声明了
QLabel* dots[3][3];
并在 ExtWiiMote.cpp
中使用 dots[3][0]...
。
修复 dots
数组大小,也许你会没事的。
关于c++ - Qt 堆内存损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3574147/