The errors location will be findet.

This commit is contained in:
Andrei Yankovich 2020-12-16 23:02:59 +03:00
parent bcebc628c4
commit cb7e96dc9c
4 changed files with 18 additions and 3 deletions

View File

@ -3,6 +3,7 @@
#include <QCoreApplication>
#include <QDateTime>
#include <QThread>
#include <QDebug>
// Private implementation of waitFor functions.
#define waitPrivate(CONDITION, TIMEOUT) \
@ -26,6 +27,17 @@ void Async::asyncHandler(Job job,
bool result = job();
/*This IS ULTRA BUG
* For reproduse:
* 1. run gdb
* 2. skip the 3 step of the asyncLauncher method.
* 3. add breackpoint in to this function.
* 4. operator = for the resultOfWork operand broken the stack of main thread.
* This is true magick.
* -\_O_/-
* */
qDebug() << resultOfWork << " : " << *resultOfWork;
if (resultOfWork)
*resultOfWork = result;

View File

@ -19,7 +19,9 @@ using namespace PKG;
AsyncSqlDbWriter::AsyncSqlDbWriter(QObject *ptr):
SqlDBWriter(ptr) {
_own = new QThread(this);
_own = new QThread();
_own->setObjectName("AsyncSqlDbWriter");
moveToThread(_own);
_own->start();
@ -28,5 +30,7 @@ AsyncSqlDbWriter::AsyncSqlDbWriter(QObject *ptr):
AsyncSqlDbWriter::~AsyncSqlDbWriter() {
_own->quit();
_own->wait();
_own->deleteLater();
}
}

View File

@ -17,7 +17,7 @@ namespace QH {
* @brief The AsyncSqlDbWriter class is some as SqlDBWriter bud run all commnad in own thread
* This class is thread save.
*/
class AsyncSqlDbWriter : public SqlDBWriter
class AsyncSqlDbWriter final : public SqlDBWriter
{
Q_OBJECT
public:

View File

@ -20,7 +20,6 @@
#include <QSqlRecord>
#include <QStandardPaths>
#include <QCoreApplication>
#include <QThread>
namespace QH {
using namespace PKG;