diff --git a/frontend/model/search-result-manager.cpp b/frontend/model/search-result-manager.cpp index b0811f8..9358f37 100644 --- a/frontend/model/search-result-manager.cpp +++ b/frontend/model/search-result-manager.cpp @@ -48,10 +48,10 @@ void SearchResultManager::stopSearch() { if(m_getResultThread->isRunning()) { m_getResultThread->stop(); - SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_pluginId); - plugin->stopSearch(); - qDebug() << m_pluginId << "stopped"; } + SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_pluginId); + plugin->stopSearch(); + qDebug() << m_pluginId << "stopped"; } void SearchResultManager::initConnections() diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index 4d6df63..228f7a5 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -541,7 +541,14 @@ void DirectSearch::run() { } bfs.enqueue(i.absoluteFilePath()); } - match(i); + SearchManager::m_mutexDir.lock(); + if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) { + match(i); + SearchManager::m_mutexDir.unlock(); + } else { + SearchManager::m_mutexDir.unlock(); + return; + } } } } @@ -549,29 +556,10 @@ void DirectSearch::run() { void DirectSearch::match(const QFileInfo &info) { if(info.fileName().contains(m_keyword, Qt::CaseInsensitive)) { - if((info.isDir() && m_value == DIR_SEARCH_VALUE)) { + if((info.isDir() && m_value == DIR_SEARCH_VALUE) || (info.isFile() && m_value == FILE_SEARCH_VALUE)) { SearchPluginIface::ResultInfo ri; if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) { - SearchManager::m_mutexDir.lock(); - if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) { - m_searchResult->enqueue(ri); - SearchManager::m_mutexDir.unlock(); - } else { - SearchManager::m_mutexDir.unlock(); - return; - } - } - } else if (info.isFile() && m_value == FILE_SEARCH_VALUE) { - SearchPluginIface::ResultInfo ri; - if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) { - SearchManager::m_mutexFile.lock(); - if(m_uniqueSymbol == SearchManager::uniqueSymbolFile) { - m_searchResult->enqueue(ri); - SearchManager::m_mutexFile.unlock(); - } else { - SearchManager::m_mutexFile.unlock(); - return; - } + m_searchResult->enqueue(ri); } } }