开发者

Qt heap memory corruption

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 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.

Here is the source code:

  • Main.cpp http://pastebin.com/DeUvZSHU
  • TesterWindow.h http://pastebin.com/SEVr8x40
  • Teste开发者_运维知识库rWindow.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

(You can't compile it, I can't share the used library)

What's wrong?


In ExtWiiMote.h you declared

QLabel* dots[3][3];

and in the ExtWiiMote.cpp you use dots[3][0]....

Fix dots array size and probably you'll be fine.


I had the same error last month but since lots of different problems can cause it, I'm not sure my answer will help you.

This was caused by a derived class (Child) without virtual destructor. The error pops up each time the debugger was entering the destructor of Child. Since I'm at work and can not access to the website to get source code I can not check this.

Hope this may help you

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜