PDA

View Full Version : generic catch-all error during runtime



babygal
21st June 2010, 10:05
I am getting runtime error as in attachment.
Code :

QDoubleSpinBox *AspinBox,*BspinBox,*CspinBox,*DspinBox;
func( float&,float&,float&,float&);
float a,b,c,d;

AspinBox= new QDoubleSpinBox;
BspinBox= new QDoubleSpinBox;
CspinBox= new QDoubleSpinBox;
DspinBox= new QDoubleSpinBox;

a = AspinBox->cleanText().toFloat();
b = BspinBox->cleanText().toFloat();
c = CspinBox->cleanText().toFloat();
d = DspinBox->cleanText().toFloat();

QString strA = QString::number( a );
QMessageBox::about(this,tr("ED apical trim in mm #"),strA ); //value read back is correct
func(a, b, c, d); //I guess this function is causing error


Error in attachment is read as :
Application.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
If you were in the middle of something, the information you were working on might be lost.

Please tell Microsoft about this problem.
We have created an error report that you can send to us. We will treat this report as confidential and anonymous. To see what data this error report contains, click here.

high_flyer
21st June 2010, 10:20
run the code in a debugger, and you will not have to guess which lines crashes.
if func() is crashing, please show us the implementation of func().

babygal
22nd June 2010, 03:43
When debugging , line #17 is found to be causing the crash.

Code :

bool func( float& floatA, float& floatB, float& floatC, float& floatD )
{
return inst->func(floatA, floatB, floatC, floatD );
}

totem
22nd June 2010, 09:03
inst is NULL or dirty probably, put a breakpoint in func() and check this pointer value in debugger. What type is it ? Where do you initialize inst ?

babygal
23rd June 2010, 03:33
inst is NULL or dirty probably, put a breakpoint in func() and check this pointer value in debugger. What type is it ? Where do you initialize inst ?

Value in debugger is 8b.
func() is of boolean type.
inst is initialized in .cpp file in .dll project.

ChrisW67
23rd June 2010, 05:20
"8b" as a pointer looks suspect. Is it "8b" immediately after it is allocated? Are you sure this is not an error return code rather than a pointer?

babygal
23rd June 2010, 05:45
"8b" as a pointer looks suspect. Is it "8b" immediately after it is allocated? Are you sure this is not an error return code rather than a pointer?
Yes, '8b' is the value immediately after it is allocated. It may be an error return code.How do i confirm this?
When the program exits, there is a message in debugger which is read as:
-Program exited with exit code exit-code="030000000015".

high_flyer
23rd June 2010, 08:53
inst is initialized in .cpp file in .dll project.
How do you know that for sure?
Put a break point in the DLL where inst gets initialized and see if it gets caught.

Also initialize it to NULL when you start the application, so if the DLL does initialize it later, it will change from NULL.
And where you call it, first test for NULL.

If you put a break point on that call, some debuggers (like MSVS) will tell you if the pointer is dirty or not.
So that is another check.
Also, at some point you need to get the pointer from the DLL, put a break point there and see if it gets caught before you call the code you posted above.
If not, 'inst' is not initialized.