Have a look at the comments I have inserted into your code snippets
Which part of "The program has unexpectedly finished." means "exiting without error"?file.h:
Qt Code:
#include <QObject> class FThread; { Q_OBJECT public: FThread *fthread; // ^^^^^ Where does this pointer ever get an instance of FThread attached to it? public slots: void print(); };To copy to clipboard, switch view to plain text mode
file.cpp:
Qt Code:
#include "file.h" #include <QDebug> #include "fthread.h" { connect(fthread,SIGNAL(done()),this,SLOT(print())); // ^^^^^ you use fthread here but is has not been initialised either 0 (NULL) // or to be a valid pointer. // On the way to crash city } void File::print(){ qDebug()<<"printing from File object"; fthread.exit(); // ^^^^^ given that fthread is a pointer I am surprised this even compiles }To copy to clipboard, switch view to plain text mode
NOTE:
i get following output:
App started
The program has unexpectedly finished.
...path/Thread exited with code 0
means it is exiting without error
Have you single-stepped the program to see at what point the program terminates unexpectedly?





Reply With Quote

Bookmarks