I'm struggling to get my destructor called in a class of mine that is moved to a separate thread
In my class's header file: class myClass { Q_OBJECT ... } In my class's .cpp file: myClass::~myClass() { qDebug("myClass destructor"); } MainWindow.h: QThread* myThread; myClass* mine; My mainwindow's .cpp file: MainWindow::MainWindow(QWidget *parent) { mine = new myClass(); myThread = new QThread(this); mine->moveToThread(myThread); myThread->start(); } MainWindow::~MainWindow() { myThread ->exit(); delete ui; } When I run my application, myClass functions properly, signals and slots in it are being called. But when the user clicks the MainWindow's 'X' button to close the application, the destructor for my class is never called, or at least that qDebug() statement is never printed to the console. Any thoughts?
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest