When closing application Exception Triggered.
-
Is there anything I can do to help me trace what is causing an Exception Triggered dialog to be displayed when the application is shut down?
I've put a breakpoint in the class destructor Trainer and single stepped through it, everything looks ok and the exception seems to occur after exiting the exec() function, this is the main body:
int main(int arc, char *argv[]) { Trainer trainer(argc, argv); MainWindow w; w.show(); return trainer.exec(); }
-
Hi
Nothing is shown in the debugger call stack ? -
@mrjj , yes the call stack, but there all go directly to assembler. The actual stop point is in:
RPCRT4!NDRCContextBinding: 0x759ede63 <+0x0013> cpp. sword ptr [eax+4], 0FEDCBA98h
-
@mrjj , yes the call stack, but there all go directly to assembler. The actual stop point is in:
RPCRT4!NDRCContextBinding: 0x759ede63 <+0x0013> cpp. sword ptr [eax+4], 0FEDCBA98h
Hi
Ok that is not super informative.I think its maybe in the clean up phase something explodes.
You can try this
https://stackoverflow.com/questions/16735413/how-can-i-make-qtcreator-break-on-exceptionsIt tells the debugger to stop where excpetion is thrown. maybe it can give a hint on whap happens.
Also I would try
// MainWindow w;
// w.show();to see if its in trainer OR in the Mainwindow something happens.
Do you load or link any other DLLS etc ?
-
@SPlatten
If we know nothing aboutTrainer
, how would we answer?Try replacing
Trainer trainer
withTrainer *trainer = new Trainer
. Hopefully that avoids destructor being called. Does it still crash? -
Hi
Ok that is not super informative.I think its maybe in the clean up phase something explodes.
You can try this
https://stackoverflow.com/questions/16735413/how-can-i-make-qtcreator-break-on-exceptionsIt tells the debugger to stop where excpetion is thrown. maybe it can give a hint on whap happens.
Also I would try
// MainWindow w;
// w.show();to see if its in trainer OR in the Mainwindow something happens.
Do you load or link any other DLLS etc ?
@mrjj said in When closing application Exception Triggered.:
https://stackoverflow.com/questions/16735413/how-can-i-make-qtcreator-break-on-exceptions
Tried that, no different.
-
@mrjj said in When closing application Exception Triggered.:
https://stackoverflow.com/questions/16735413/how-can-i-make-qtcreator-break-on-exceptions
Tried that, no different.
-
@mrjj , I've just commented out everything in the MainWindow destructor, recompiled and run and its still doing the same.
-
@SPlatten
Hi
ok. and you not having any members of QObject base in the class ?
I mean as non pointer in MainWindow.
Its sometimes possible to get double deletes that way.@mrjj , at the moment the application is in very early stages for the MainWindow class contains just:
DataSets* mpDataSetsDlg; Ui::MainWindow* mpui;
In the constructor:
MainWindow::MainWindow(QWidget* pParent) : QMainWindow(pParent), mpDataSetsDlg(nullptr), mpui(new Ui:MainWindow) { mpui->setupUi(this); connect(mpui->btnDataSets, &QPushButton->clicked, this, &MainWindow::dataSetsBtnClicked); }
In the destructor:
void MainWindow::~MainWindow() { if ( mpDataSetsDlg != nullptr ) { delete mpDataSetsDlg; mpDataSetsDlg = nullptr; } delete mpui; mpui = nullptr; }
-
@mrjj , I've just commented out everything in the MainWindow destructor, recompiled and run and its still doing the same.
@SPlatten
Remove all your#include
s, other than what is required to get a minimal Qt program open a main window. It should be 10 lines long. NoTrainer
object NoTrainer
include files. Does it work?If your program only crashes with
Trainer
and its include files, I still don't understand what we can say since we don't even know what it is. -
@SPlatten
Remove all your#include
s, other than what is required to get a minimal Qt program open a main window. It should be 10 lines long. NoTrainer
object NoTrainer
include files. Does it work?If your program only crashes with
Trainer
and its include files, I still don't understand what we can say since we don't even know what it is.@JonB , I modified main.cpp to:
#include <QApplication> //Add this #include "main window.h" //#include "trainer.h" int main(int argc, char* argv[]) { //Trainer trainer(argc, argv); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); //return trainer.exec(); }
Rebuilt and it does exactly the same, crash location is in exactly the same place.
-
@JonB , I modified main.cpp to:
#include <QApplication> //Add this #include "main window.h" //#include "trainer.h" int main(int argc, char* argv[]) { //Trainer trainer(argc, argv); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); //return trainer.exec(); }
Rebuilt and it does exactly the same, crash location is in exactly the same place.
-
@JonB , I modified main.cpp to:
#include <QApplication> //Add this #include "main window.h" //#include "trainer.h" int main(int argc, char* argv[]) { //Trainer trainer(argc, argv); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); //return trainer.exec(); }
Rebuilt and it does exactly the same, crash location is in exactly the same place.
@SPlatten
Remove#include "main window.h"
and replaceMainWindow w;
byQMainWindow w;
(with presumably#include <QMainWindow>
).If that does not work, since it is the minimal Qt application what has changed for you since you last successfully built/ran any Qt GUI program?
-
@SPlatten
Remove#include "main window.h"
and replaceMainWindow w;
byQMainWindow w;
(with presumably#include <QMainWindow>
).If that does not work, since it is the minimal Qt application what has changed for you since you last successfully built/ran any Qt GUI program?
@JonB , to be honest, it could be the build of the laptop, its an older version of Qt:
Qt Creator 4.4.1 Based on Qt 5.9.2 (MSVC 2015, 32 bit)
I have no control over the laptop or the version of Qt being used, this is supplied by the company I am contracted to.
-
@SPlatten well, in the stack trace, what's the first entry, thats from your code ?
you know that you can step back, when you're in assembler code right?
-
@J-Hilk , I've expanded the stack trace and there is no call the traces back to my source, the first call is in Function: RtlGetAppContainerNamedObjectPath, File: ntdll
@SPlatten thats unfortunate
since this is a basic and small project so far, can you share, the minimal example ?
that means probably only your custom MainWindow, so we can check ourselves, and check it against different Qt versions as well
-
@SPlatten thats unfortunate
since this is a basic and small project so far, can you share, the minimal example ?
that means probably only your custom MainWindow, so we can check ourselves, and check it against different Qt versions as well
@J-Hilk
That is why I suggested @SPlatten should useQMainWindow
, not his ownMainWindow
, to test. If that still does not work (I'm not sure if he has answered that), then something is fundamentally with his Qt/environment. I would do that before examining anything about a customMainWindow
or header file. -
@SPlatten thats unfortunate
since this is a basic and small project so far, can you share, the minimal example ?
that means probably only your custom MainWindow, so we can check ourselves, and check it against different Qt versions as well
@J-Hilk , in doing this, I decided to go one better. I did the following in Qt Creator:
- Clicked on File top line menu
- Selected New File or Project...
- Selected Application and Qt Widgets Application
- Clicked on the Choose... button
- Entered test into Name: text box and clicked the Next button
- Checked only Desktop Qt 5.9.2 MSVC2015 32bit in Kit Selection
- Clicked Next button
- Clicked Next button
- Clicked Finish button
- Right clicked project and selected Rebuild
- Run application in debug mode and clicked the close widget in the MainWindow
Same thing happens, application stops and Exception Triggered dialog is displayed.