Just recently I’ve installed the Qt libraries on my computer, and as a complete novice I looked up the Qt 4.7 Getting Started guides online.
Just on the first page they provide the following code:
1 #include <QtGui>
2
3 int main(int argv, char **args)
4 {
5 QApplication app(argv, args);
6
7 QTextEdit textEdit;
8 QPushButton quitButton("Quit");
9
10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
11
12 QVBoxLayout layout;
13 layout.addWidget(&textEdit);
14 layout.addWidget(&quitButton);
15
16 QWidget window;
17 window.setLayout(&layout);
18
19 window.show();
20
21 return app.exec();
22 }
Simple stuff, I would suppose. Upon writing this code in Visual Studio Express 2010, building, and running, most everything works. However, when I try to close the window by means of the “Quit” button or the red-x in the top right of the displayed window (initiating “return app.exec()”), I receive the following:
A dialog box saying,
Unhandled exception at 0x77bc15de in ParticleTracker.exe: 0xC0000005: Access violation reading location 0xdf94b4b4.
And console output saying,
Critical error detected c0000374
Windows has triggered a breakpoint in ParticleTracker.exe.
This may be due to a corruption of the heap, which indicates a bug in ParticleTracker.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while ParticleTracker.exe has focus.
Having entered the debug-mode, I continued through the call stack while repeatedly receiving heap corruption errors.
First-chance exception at 0x77c6e6c3 in ParticleTracker.exe: 0xC0000374: A heap has been corrupted.
Unhandled exception at 0x77bc15de in ParticleTracker.exe: 0xC0000374: A heap has been corrupted.
All of the subsequent exceptions occurred at 0x77bc15de in the executable, with the memory address 0xC0000374 as a corrupted heap.
Honestly, I’m not precisely sure how I could even be getting this issue; I’m not well-versed in C++, but there appears to be nothing wrong with the code.
In the Call-Stack, the process is currently stuck at:
ParticleTracker.exe!main(int argv, char** args) Line 20 + 0x27 bytes
If I enter the disassembly the process is stuck at:
return app.exec();
00FE3831 mov esi,esp
00FE3833 call dword ptr [__imp_QApplication::exec (0FE93D0h)]
00FE3839 cmp esi,esp
00FE383B call @ILT+320(__RTC_CheckEsp) (0FE1145h)
00FE3840 mov dword ptr [ebp-150h],eax
00FE3846 mov byte ptr [ebp-4],5
00FE384A mov esi,esp
00FE384C lea ecx,[ebp-84h]
00FE3852 call dword ptr [__imp_QWidget::~QWidget (0FE9404h)]
00FE3858 cmp esi,esp
Any tips? Much appreciated. 🙂
Try this one