forked from openkylin/ukui-search
Merge pull request #65 from iaom/0110-dev
Add lock in deconstruction of index-generator.
This commit is contained in:
commit
f0984c5a14
|
@ -22,10 +22,6 @@ FileSearcher::~FileSearcher()
|
||||||
|
|
||||||
void FileSearcher::onKeywordSearch(QString keyword,QQueue<QString> *searchResultFile,QQueue<QString> *searchResultDir,QQueue<QPair<QString,QStringList>> *searchResultContent)
|
void FileSearcher::onKeywordSearch(QString keyword,QQueue<QString> *searchResultFile,QQueue<QString> *searchResultDir,QQueue<QPair<QString,QStringList>> *searchResultContent)
|
||||||
{
|
{
|
||||||
m_search_result_file = searchResultFile;
|
|
||||||
m_search_result_dir = searchResultDir;
|
|
||||||
m_search_result_content = searchResultContent;
|
|
||||||
|
|
||||||
m_mutex1.lock();
|
m_mutex1.lock();
|
||||||
++uniqueSymbol1;
|
++uniqueSymbol1;
|
||||||
m_mutex1.unlock();
|
m_mutex1.unlock();
|
||||||
|
@ -35,6 +31,11 @@ void FileSearcher::onKeywordSearch(QString keyword,QQueue<QString> *searchResult
|
||||||
m_mutex3.lock();
|
m_mutex3.lock();
|
||||||
++uniqueSymbol3;
|
++uniqueSymbol3;
|
||||||
m_mutex3.unlock();
|
m_mutex3.unlock();
|
||||||
|
|
||||||
|
m_search_result_file = searchResultFile;
|
||||||
|
m_search_result_dir = searchResultDir;
|
||||||
|
m_search_result_content = searchResultContent;
|
||||||
|
|
||||||
//file
|
//file
|
||||||
QtConcurrent::run([&, uniqueSymbol1](){
|
QtConcurrent::run([&, uniqueSymbol1](){
|
||||||
if(!m_search_result_file->isEmpty())
|
if(!m_search_result_file->isEmpty())
|
||||||
|
|
|
@ -120,6 +120,7 @@ IndexGenerator::IndexGenerator(bool rebuild, QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
IndexGenerator::~IndexGenerator()
|
IndexGenerator::~IndexGenerator()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
qDebug() << "~IndexGenerator";
|
qDebug() << "~IndexGenerator";
|
||||||
if(m_datebase_path)
|
if(m_datebase_path)
|
||||||
delete m_datebase_path;
|
delete m_datebase_path;
|
||||||
|
|
Loading…
Reference in New Issue