forked from qt-creator/qt-creator
Stop executing locator's threads when about to shutdown occurred
Mark that about to shutdown has occurred and don't start any new thread after that. Fixes: QTCREATORBUG-25318 Change-Id: I14d47c93dd8e8a82f6f68264a03d5831ec95da75 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -443,6 +443,7 @@ QString CorePlugin::msgCrashpadInformation()
|
||||
ExtensionSystem::IPlugin::ShutdownFlag CorePlugin::aboutToShutdown()
|
||||
{
|
||||
Find::aboutToShutdown();
|
||||
m_locator->aboutToShutdown();
|
||||
m_mainWindow->aboutToShutdown();
|
||||
return SynchronousShutdown;
|
||||
}
|
||||
|
@@ -169,6 +169,16 @@ bool Locator::delayedInitialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Locator::aboutToShutdown()
|
||||
{
|
||||
m_refreshTimer.stop();
|
||||
if (m_refreshTask.isRunning()) {
|
||||
m_refreshTask.cancel();
|
||||
m_refreshTask.waitForFinished();
|
||||
}
|
||||
emit aboutToShutdownOccurred();
|
||||
}
|
||||
|
||||
void Locator::loadSettings()
|
||||
{
|
||||
SettingsDatabase *settings = ICore::settingsDatabase();
|
||||
|
@@ -48,6 +48,7 @@ public:
|
||||
~Locator() override;
|
||||
|
||||
static Locator *instance();
|
||||
void aboutToShutdown();
|
||||
|
||||
void initialize();
|
||||
void extensionsInitialized();
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
|
||||
signals:
|
||||
void filtersChanged();
|
||||
void aboutToShutdownOccurred();
|
||||
|
||||
public slots:
|
||||
void refresh(QList<ILocatorFilter *> filters);
|
||||
|
@@ -616,6 +616,13 @@ LocatorWidget::LocatorWidget(Locator *locator) :
|
||||
connect(qApp, &QApplication::focusChanged, this, &LocatorWidget::updatePreviousFocusWidget);
|
||||
|
||||
connect(locator, &Locator::filtersChanged, this, &LocatorWidget::updateFilterList);
|
||||
connect(locator, &Locator::aboutToShutdownOccurred, this, [this]() {
|
||||
m_shuttingDown = true;
|
||||
if (m_entriesWatcher->isRunning()) {
|
||||
m_entriesWatcher->cancel();
|
||||
m_entriesWatcher->waitForFinished();
|
||||
}
|
||||
});
|
||||
updateFilterList();
|
||||
}
|
||||
|
||||
@@ -828,6 +835,9 @@ void LocatorWidget::setProgressIndicatorVisible(bool visible)
|
||||
|
||||
void LocatorWidget::updateCompletionList(const QString &text)
|
||||
{
|
||||
if (m_shuttingDown)
|
||||
return;
|
||||
|
||||
m_updateRequested = true;
|
||||
if (m_entriesWatcher->future().isRunning()) {
|
||||
// Cancel the old future. We may not just block the UI thread to wait for the search to
|
||||
|
@@ -98,6 +98,7 @@ private:
|
||||
QTimer m_showPopupTimer;
|
||||
QFutureWatcher<LocatorFilterEntry> *m_entriesWatcher = nullptr;
|
||||
QString m_requestedCompletionText;
|
||||
bool m_shuttingDown = false;
|
||||
bool m_needsClearResult = true;
|
||||
bool m_updateRequested = false;
|
||||
bool m_possibleToolTipRequest = false;
|
||||
|
Reference in New Issue
Block a user