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()
|
ExtensionSystem::IPlugin::ShutdownFlag CorePlugin::aboutToShutdown()
|
||||||
{
|
{
|
||||||
Find::aboutToShutdown();
|
Find::aboutToShutdown();
|
||||||
|
m_locator->aboutToShutdown();
|
||||||
m_mainWindow->aboutToShutdown();
|
m_mainWindow->aboutToShutdown();
|
||||||
return SynchronousShutdown;
|
return SynchronousShutdown;
|
||||||
}
|
}
|
||||||
|
@@ -169,6 +169,16 @@ bool Locator::delayedInitialize()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Locator::aboutToShutdown()
|
||||||
|
{
|
||||||
|
m_refreshTimer.stop();
|
||||||
|
if (m_refreshTask.isRunning()) {
|
||||||
|
m_refreshTask.cancel();
|
||||||
|
m_refreshTask.waitForFinished();
|
||||||
|
}
|
||||||
|
emit aboutToShutdownOccurred();
|
||||||
|
}
|
||||||
|
|
||||||
void Locator::loadSettings()
|
void Locator::loadSettings()
|
||||||
{
|
{
|
||||||
SettingsDatabase *settings = ICore::settingsDatabase();
|
SettingsDatabase *settings = ICore::settingsDatabase();
|
||||||
|
@@ -48,6 +48,7 @@ public:
|
|||||||
~Locator() override;
|
~Locator() override;
|
||||||
|
|
||||||
static Locator *instance();
|
static Locator *instance();
|
||||||
|
void aboutToShutdown();
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
@@ -62,6 +63,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void filtersChanged();
|
void filtersChanged();
|
||||||
|
void aboutToShutdownOccurred();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refresh(QList<ILocatorFilter *> filters);
|
void refresh(QList<ILocatorFilter *> filters);
|
||||||
|
@@ -616,6 +616,13 @@ LocatorWidget::LocatorWidget(Locator *locator) :
|
|||||||
connect(qApp, &QApplication::focusChanged, this, &LocatorWidget::updatePreviousFocusWidget);
|
connect(qApp, &QApplication::focusChanged, this, &LocatorWidget::updatePreviousFocusWidget);
|
||||||
|
|
||||||
connect(locator, &Locator::filtersChanged, this, &LocatorWidget::updateFilterList);
|
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();
|
updateFilterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,6 +835,9 @@ void LocatorWidget::setProgressIndicatorVisible(bool visible)
|
|||||||
|
|
||||||
void LocatorWidget::updateCompletionList(const QString &text)
|
void LocatorWidget::updateCompletionList(const QString &text)
|
||||||
{
|
{
|
||||||
|
if (m_shuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
m_updateRequested = true;
|
m_updateRequested = true;
|
||||||
if (m_entriesWatcher->future().isRunning()) {
|
if (m_entriesWatcher->future().isRunning()) {
|
||||||
// Cancel the old future. We may not just block the UI thread to wait for the search to
|
// 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;
|
QTimer m_showPopupTimer;
|
||||||
QFutureWatcher<LocatorFilterEntry> *m_entriesWatcher = nullptr;
|
QFutureWatcher<LocatorFilterEntry> *m_entriesWatcher = nullptr;
|
||||||
QString m_requestedCompletionText;
|
QString m_requestedCompletionText;
|
||||||
|
bool m_shuttingDown = false;
|
||||||
bool m_needsClearResult = true;
|
bool m_needsClearResult = true;
|
||||||
bool m_updateRequested = false;
|
bool m_updateRequested = false;
|
||||||
bool m_possibleToolTipRequest = false;
|
bool m_possibleToolTipRequest = false;
|
||||||
|
Reference in New Issue
Block a user