Merge pull request #76 from mammonsama666/0113-dev
fix(thread): Search result is incorrect because of thread quit.
This commit is contained in:
commit
b78de0f929
|
@ -22,9 +22,9 @@ SearchResult::~SearchResult()
|
||||||
void SearchResult::run()
|
void SearchResult::run()
|
||||||
{
|
{
|
||||||
QTimer * m_timer = new QTimer;
|
QTimer * m_timer = new QTimer;
|
||||||
|
m_timer->setInterval(3000);
|
||||||
int emptyLists = 0;
|
int emptyLists = 0;
|
||||||
while(!isInterruptionRequested()) {
|
while(!isInterruptionRequested()) {
|
||||||
qWarning()<<"--------------------";
|
|
||||||
emptyLists = 0;
|
emptyLists = 0;
|
||||||
m_mainwindow->m_searcher->m_mutex1.lock();
|
m_mainwindow->m_searcher->m_mutex1.lock();
|
||||||
if (!m_mainwindow->m_search_result_file->isEmpty()) {
|
if (!m_mainwindow->m_search_result_file->isEmpty()) {
|
||||||
|
@ -44,7 +44,7 @@ void SearchResult::run()
|
||||||
}
|
}
|
||||||
m_mainwindow->m_searcher->m_mutex3.lock();
|
m_mainwindow->m_searcher->m_mutex3.lock();
|
||||||
if (!m_mainwindow->m_search_result_content->isEmpty())
|
if (!m_mainwindow->m_search_result_content->isEmpty())
|
||||||
qDebug() << m_mainwindow->m_search_result_content->head();
|
// qDebug() << m_mainwindow->m_search_result_content->head();
|
||||||
if (!m_mainwindow->m_search_result_content->isEmpty()) {
|
if (!m_mainwindow->m_search_result_content->isEmpty()) {
|
||||||
Q_EMIT this->searchResultContent(m_mainwindow->m_search_result_content->dequeue());
|
Q_EMIT this->searchResultContent(m_mainwindow->m_search_result_content->dequeue());
|
||||||
m_mainwindow->m_searcher->m_mutex3.unlock();
|
m_mainwindow->m_searcher->m_mutex3.unlock();
|
||||||
|
|
|
@ -327,23 +327,24 @@ QWidget* QtSingleApplication::activationWindow() const
|
||||||
*/
|
*/
|
||||||
void QtSingleApplication::activateWindow()
|
void QtSingleApplication::activateWindow()
|
||||||
{
|
{
|
||||||
if (actWin) {
|
//单例置顶策略,由于bootOptionsFilter in mainwindow自带置顶策略,故注掉此处
|
||||||
if(this->applicationState() & Qt::ApplicationInactive)
|
// if (actWin) {
|
||||||
{
|
// if(this->applicationState() & Qt::ApplicationInactive)
|
||||||
MainWindow* w=qobject_cast<MainWindow*>(actWin);
|
// {
|
||||||
// w->loadMainWindow();
|
// MainWindow* w=qobject_cast<MainWindow*>(actWin);
|
||||||
w->clearSearchResult();
|
//// w->loadMainWindow();
|
||||||
actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
|
// w->clearSearchResult();
|
||||||
actWin->raise();
|
// actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
|
||||||
actWin->showNormal();
|
// actWin->raise();
|
||||||
actWin->activateWindow();
|
// actWin->showNormal();
|
||||||
}
|
// actWin->activateWindow();
|
||||||
else {
|
// }
|
||||||
actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized);
|
// else {
|
||||||
actWin->hide();
|
// actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized);
|
||||||
}
|
// actWin->hide();
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue