Exception Triggered
-
I think this may be down to the version of Qt being used, but I would like to know if there is a way of preventing this issue.
In my main function I test for the command line arguments passed:
void error(const char* cpszMsg) { perror(cpszMsg); QApplication::quit(); exit(-1); } int main(int argc, char* argv[]) { if ( argc < 2 ) { error(static_cast<const char*>("Please specify configuration file!")); } Application a(arc, argue); MainWindow w; w.show(); return a.exec(); }
This project is using Qt 5.9.2 and Microsoft Visual Studio 2015 32bit. The versions of Qt and MSVC are required by the application and company I am contracted to.
When launching the application without any command line arguments to test I can see the error handler is triggered however following this is an Exception Triggered dialog containing:
The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x7706de63, code: 0xc000005: read access violation at 0x0, flags = 0x0 (first chance).
This doesn't happen on later versions of Qt, is there any way to prevent this dialog from being displayed on this version of Qt ?
-
I am wondering what is the outcome of
QApplication::quit
if noQApplication
has been started...@JohanSolo , I've tried numerous permutations, with and without QApplication::quit, also with and without exit, just returning -1 from main.
All result in the same dialog appearing.
-
@SPlatten said in Exception Triggered:
also with and without exit, just returning -1 from main.
So you say that
int main(int argc, char* argv[]) { if ( argc < 2 ) { return -1; } QApplication a(arc, argv); return a.exec(); }
crashes also?
-
@JohanSolo , I've tried numerous permutations, with and without QApplication::quit, also with and without exit, just returning -1 from main.
All result in the same dialog appearing.
-
@SPlatten said in Exception Triggered:
also with and without exit, just returning -1 from main.
So you say that
int main(int argc, char* argv[]) { if ( argc < 2 ) { return -1; } QApplication a(arc, argv); return a.exec(); }
crashes also?
@Christian-Ehrlicher , It doesn't crash, but when the application terminates the dialog is displayed.
-
@SPlatten I guess the problem is that you try to destroy a QApplication which doesn't exists:
void error(const char* cpszMsg) { perror(cpszMsg); if(qApp) QApplication::quit(); exit(-1); }
@KroMignon I think this could be an issue with the Qt 5.9 SDK, because on later versions it does not do the same.
-
@KroMignon I think this could be an issue with the Qt 5.9 SDK, because on later versions it does not do the same.