Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance)
-
My gui was crashing so i decided to debug my program.
The Error Occurs to happen at this particular point
int nObjects = std::stoi(dtObjects); // my dtObjects is std::string
Below you can find Application Output which i got from QtCreator and also i attached screenshot of the error which i am getting when i tried to debug!
Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in SYSFER Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in MSVCP140D!std::_Xinvalid_argument Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) in MSVCP140D!std::_Xinvalid_argument
![alt text]( image url)
Can someone please help me why this is happening?
I found similar questions like this(https://forum.qt.io/topic/69597/warning-c-exception-flags-0x1) in this forum but they are not yet solved or person who raised question forgot to update the status!
Regarding my pc
Its windows 64bit and
calibrator is Desktop Qt MSVC2015 64 bit! -
@aravmadd
I'm not sure why you get such a severe exception. But from the error messages you are falling foul of the:if (_Ptr == _Eptr) _XinvalidArgument(...);
case.
Which I think is happening because not even one character of your string can be converted (doesn't start with a decimal digit). So what's in your string, you can see it in the debugger?
-
@JonB said in Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance):
Which I think is happening because not even one character of your string can be converted
I can see. It is "3"
-
Take a look at the backtrace to see where the crash comes from.
-
@Christian-Ehrlicher . I checked it and it is showing me at line 116 is the problem and line 116 is int nBodies = std::stoi(dtBodies);![alt text]( image url).
I will also check if all my things are pointing towards correct things.! I checked once but will try to revisit entire code and see but from the error iniformation i think everything should be fine
-
So what do you do in widget.cpp:116?
-
@Christian-Ehrlicher I convert string to int in that particular line 116.
-
Come on... please show the code and the input value.
-
@aravmadd said in Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance):
@JonB said in Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance):
Which I think is happening because not even one character of your string can be converted
I can see. It is "3"
Verify in the debugger my suggestion that
_Ptr == _Eptr
is true? And what is*_Ptr
?While you're also responding to @Christian-Ehrlicher .
-
std::string dtObjects; bool ok = dt->getinfo("number_of_objects", dtObjects ); if ( false == ok ) { ui->plainTextEdit->appendPlainText("Could not retrieve information!" ); } int nObjects = std::stoi(dtObjects); ui->plainTextEdit->appendPlainText("No of Objects: " + QString::number(nObjects));
and below you can find declaration of this getinfo function.
bool process::getinfo(const std::string& para, std::string& val)
I am assuming somewhere wrong going during the process(like since i am using reference i might be doing somewhere wrong). Currently i am doing this thing will get back as soon as possible!
-
@aravmadd
And prove to us what isdtObjects
? And what is your code doing since you allow it to continue afterfalse == ok
--- why would you do that?? So for all we know this could easily be being produced becausedtObjects
does not contain what you said it contains.... -
@aravmadd said in Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance):
int nObjects = std::stoi(dtObjects);
ui->plainTextEdit->appendPlainText("No of Objects: " + QString::number(nObjects));Shouldn't this be in an else {} block?
-
@aravmadd said in Exception at 0x7ffaea0496c9, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance):
dtObjects
And how do you check that this is really a number?
Please read the docs and do what you have to when you don't do the sanity check by yourself:
Exceptions
std::invalid_argument if no conversion could be performed std::out_of_range if the converted value would fall out of the range of the result type or if the underlying function (std::strtol or std::strtoll) sets errno to ERANGE.
-
This post is deleted!
-
It is solved. I should keep that part in else block. When i was doing checks i found that then i also saw the same in comment. When coming to your question, it always gives the number of devices available, so that string always contains int values. like 3 or 4 or 8 not more than 9 .
But I would like to say sorry for everyone here because I completly lost in the code because i completly missed else block which is a big blunder.
But anways thanks for all the help. With all your comments i also got various ideas of debugging ideas which can be helpful for future. Thanks a lot