GUI crash: protect against starting simultaneous queries

This commit is contained in:
Jean-Francois Dockes 2012-05-15 16:11:12 +02:00
parent a36149c02b
commit fc9af6abb1
2 changed files with 6 additions and 2 deletions

View File

@ -800,8 +800,9 @@ class QueryThread : public QThread {
void RclMain::initiateQuery() void RclMain::initiateQuery()
{ {
if (m_source.isNull()) if (m_queryActive || m_source.isNull())
return; return;
m_queryActive = true;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QueryThread qthr(m_source); QueryThread qthr(m_source);
@ -846,6 +847,7 @@ void RclMain::initiateQuery()
statusBar()->showMessage(msg, 0); statusBar()->showMessage(msg, 0);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
m_queryActive = false;
emit(resultsReady()); emit(resultsReady());
} }

View File

@ -70,7 +70,8 @@ public:
m_idAllStem(0), m_idAllStem(0),
m_idxproc(0), m_idxproc(0),
m_sortspecnochange(false), m_sortspecnochange(false),
m_indexerState(IXST_RUNNINGNOTMINE) m_indexerState(IXST_RUNNINGNOTMINE),
m_queryActive(false)
{ {
setupUi(this); setupUi(this);
init(); init();
@ -174,6 +175,7 @@ private:
DocSeqSortSpec m_sortspec; DocSeqSortSpec m_sortspec;
RefCntr<DocSequence> m_source; RefCntr<DocSequence> m_source;
IndexerState m_indexerState; IndexerState m_indexerState;
bool m_queryActive;
// If set on init, will be displayed either through ext app, or // If set on init, will be displayed either through ext app, or
// preview (if no ext app set) // preview (if no ext app set)