简体   繁体   中英

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:

(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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM