When closing application Exception Triggered.
-
@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.
-
@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.
-
@SPlatten Is it a 32bit bug? Try to make a 64bit build to see if you have the same problem.
-
@JoeCFD , thank you, thats a shame, the problem is the target is 32 bit so regardless of if it works in 64 bit, thats not an option.
-
@SPlatten That is unlucky. Install a 32 bit debug build of Qt 5.9.2 and debug into qt code to see the cause.