PDA

View Full Version : exe exited with code -1073741819



szisziszilvi
30th August 2011, 16:27
Hi,

I have a problem that looks pretty strange to me.

I'm making an application that uses gui. I have a QStackedWidget somewhere where I am going to use some other widgets, so I made my custom widget that is defaultWidget. This was made very simply by adding a Qt c++ form class using the QtCreator so nothing should be wrong with it.

The only thing I've done is that I put a QLabel on the ui (using the built-in Designer) and I included the header into the mainwindow.h

and it crashes like this. I don't even have an instance of that defaultWidget. I just added the
#include "metawidgets/defaultwidget.h"
line into the mainwindow.h

and it crashes with the named code. Why? What did I do wrong? I already have other classes added with the very same method and they don't crash. What is happening? I'm really confused, I have no idea how to search for the bug.

I attached a small code where I tried to remake the problem. This one works fine however this one looks the VERY same as the big one (except for the miss of all the other work from the previus week...). but really. only this simple thing causes the error that I add the 3 new files to the project and add the header to the mainwindow.h. If I comment out this line and remove the 3 files from the project everything works fine but it is impossible to move on with working.

high_flyer
30th August 2011, 16:55
run the application in a debugger, and post here the code that includes the line on which it crashed.

ChrisW67
30th August 2011, 23:48
This particular error has been addressed quite a few times in these forums.
-1073741819 = 0xC0000005 = Access violation.

You are looking for things like using uninitialized or NULL pointers in your code.

szisziszilvi
31st August 2011, 08:01
actually it crashes at the very end when I try to close the application.
I started the debugger but I am very new to this topic. I found that it stops at specific points but first I cannot really see why and second none of them are in my classes but in such Qt creations like class "Q_GUI_EXPORT QCheckBox : public QAbstractButton" or "QTableWidgetItem::~QTableWidgetItem()". Well it would be handy to find a good description of this sort of debugging because I can see I am a "hard-core-beginner" to the topic but it is really hard to find a good description for absolute beginners. I found some but for example the one example aplication (http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging-example.html) is not very informative to me.

high_flyer
31st August 2011, 08:50
When the app crashes while running in the debugger, look for the last line in your code that was executed. (in call stack)
Post a section of the code above that line that that line (including the line itself).
But from the information you supplied in the last post, I can already tell you that it *probably* has to do with a destructor called on an dangling pointer.

szisziszilvi
31st August 2011, 09:09
why does the debugger stop at some points? what does that mean? Should I simply click and click "continue" until it crashes? How do I know where is the crash if the debugger closes when I close the application?
what does that mean what you wrote "in call stack"?

high_flyer
31st August 2011, 09:35
http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging.html
http://en.wikipedia.org/wiki/Call_stack

You should really first be comfortable with using the tools you are using before doing any work with them...

szisziszilvi
1st September 2011, 08:03
honestly now that I seem to succesfully implement everything withiout using forms (design everything manually) I have the bad feeling that there went wrong something with this feature. Now it is more complicated as there will be several things on some of my widgets - that is why I wanted to use the creator - but if it will be good than worths the trouble.

wysota
1st September 2011, 08:26
Please don't blame the tools for your own mistakes.

szisziszilvi
1st September 2011, 14:53
no, I didn't mean it like that. I just tought there must be some confusion maybe because I am simply not awere of some features how forms are treated. See, if everything works without using forms then the problem was around the forms, yes, very likely that I did not set something or misset or... well, no clue. When I'll have time I will try to find the real answer (I'm not stopping learning forward nor Qt, nor debugging itself) but now it is better to move on working instead of letting time go whilst I'm stacked into this bug. I'm too close to the end of this work and I have too little time to finish it. But knowing how powerful softwares have already been written in Qt I do agree with you that the error is on my side.

wysota
1st September 2011, 16:55
Your problem has nothing to do with Designer or Creator. You have written some C++ code that is invalid, most likely it operates on an uninitialized pointer.