PDA

View Full Version : "exited with code -1073741819" Application crashes abruptly



ajpnaveen
2nd November 2010, 19:32
To
Dear People

In my project I am using two classes, MainWindow and trailDialog(a class derived from QDialog)

my objective is to create a library for trailDialog and invoke it through MainWindow class, upto now evry thing is fine, I am able to create library, invoke the trailDialog from the MainWindow.

For some reason, I have declared extern MainWindow*mainwnd; in trailDialog.cpp file and in that I have called "mainwnd->setGeometry(100,100,200,200);" in the constructor of trailDialog class. Now I have built a library for the trailDialog class, included and compiled my project using this library.

Evertthing worked fine upto compilation, but while executing the exe, the application is getting crashed and throwing the follwing exception "Sample_Qt.exe exited with code -1073741819"

Thanks in Advance
Regards
A J Prakash Naveen

tbscope
2nd November 2010, 19:41
When you program on Windows, keep a link to MSDN open.
This will tell you that the error means an access violation.

Reading your post only gives more questions than it can answer.
So, please post your code. Or, if that is not possible, create a minimal working and compiling example demonstrating the error.

ChrisW67
2nd November 2010, 21:32
To
For some reason, I have declared extern MainWindow*mainwnd; in trailDialog.cpp file and in that I have called "mainwnd->setGeometry(100,100,200,200);" in the constructor of trailDialog class. Now I have built a library for the trailDialog class, included and compiled my project using this library.
Well, what is the reason? Where is mainwnd declared and where is its value set? These sorts of crashes are quite often the result of using a NULL or undefined pointer.

In any case, the idea of the constructor of a GUI class directly altering its parent widget geometry seems like a poor design to me.

Timoteo
2nd November 2010, 22:36
Just by virtue of the declaration containing "extern" I gather that mainwnd is global. Is this true? If so, you've gotten yourself into the static initialization fiasco. (google it)