I have to downgrade a project from QT5 to QT4 and get a weird buffer overrun error when doing so. Here\'s my code:
I create a QThread like so:
thread =
void MainWindow::threadFinished() {
reader = NULL;
delete thread;
thread = NULL;
}
Deleting the thread directly in the slot is not advised. You should use the deleteLater function.
thread->deleteLater();
However, you've already setup the thread to be deleted in the connection
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
So you're now trying to delete it twice!
As for the buffer-overrun, I suspect something has corrupted memory before the error has occurred.