mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
fix: crash on quit while fullindex is creating
This commit is contained in:
parent
bf625dc550
commit
2d8ba54a1d
|
@ -36,6 +36,7 @@ void Indexing::run()
|
|||
{
|
||||
try
|
||||
{
|
||||
timerThread->start();
|
||||
// First iteration - dictionaries with no more MaxDictionarySizeForFastSearch articles
|
||||
for( size_t x = 0; x < dictionaries.size(); x++ )
|
||||
{
|
||||
|
@ -63,6 +64,9 @@ void Indexing::run()
|
|||
dictionaries.at( x )->makeFTSIndex( isCancelled, false );
|
||||
}
|
||||
}
|
||||
|
||||
timerThread->quit();
|
||||
timerThread->wait();
|
||||
}
|
||||
catch( std::exception &ex )
|
||||
{
|
||||
|
|
|
@ -89,28 +89,15 @@ public:
|
|||
timerThread(new QThread(this))
|
||||
{
|
||||
connect(timer, &QTimer::timeout, this, &Indexing::timeout);
|
||||
// timer->start(2000);
|
||||
timer->moveToThread(timerThread);
|
||||
connect(timerThread, &QThread::started, timer, [this](){timer->start(2000);});
|
||||
connect(timerThread, &QThread::finished, timer, &QTimer::stop);
|
||||
timerThread->start();
|
||||
|
||||
}
|
||||
|
||||
~Indexing()
|
||||
{
|
||||
if(timerThread){
|
||||
qInfo()<<"delete thread";
|
||||
timerThread->quit();
|
||||
timerThread->wait();
|
||||
delete timerThread;
|
||||
timerThread = nullptr;
|
||||
}
|
||||
if(timer){
|
||||
qInfo()<<"delete timer";
|
||||
delete timer;
|
||||
timer = nullptr;
|
||||
}
|
||||
|
||||
|
||||
emit sendNowIndexingName( QString() );
|
||||
hasExited.release();
|
||||
|
|
Loading…
Reference in a new issue