Commit 966bf17d authored by Eike Ziller's avatar Eike Ziller Committed by Tobias Hunger
Browse files

Fixes potential threading problem in Locator startup



Change-Id: Ifd399cd167681d90c93d3e9f7c8e09299bdfff3b
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 1504ab11
......@@ -84,6 +84,7 @@ namespace {
}
LocatorPlugin::LocatorPlugin()
: m_settingsInitialized(false)
{
m_refreshTimer.setSingleShot(false);
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
......@@ -168,8 +169,7 @@ void LocatorPlugin::extensionsInitialized()
bool LocatorPlugin::delayedInitialize()
{
connect(&m_loadWatcher, SIGNAL(finished()), this, SLOT(settingsLoaded()));
m_loadWatcher.setFuture(QtConcurrent::run(this, &LocatorPlugin::loadSettings));
loadSettings();
return true;
}
......@@ -186,19 +186,17 @@ void LocatorPlugin::loadSettings()
}
qs->remove(QLatin1String("QuickOpen"));
}
void LocatorPlugin::settingsLoaded()
{
m_locatorWidget->updateFilterList();
m_locatorWidget->setEnabled(true);
if (m_refreshTimer.interval() > 0)
m_refreshTimer.start();
m_settingsInitialized = true;
}
void LocatorPlugin::saveSettings()
{
if (Core::ICore::instance() && Core::ICore::settingsDatabase()) {
if (m_settingsInitialized) {
Core::SettingsDatabase *s = Core::ICore::settingsDatabase();
s->beginGroup(QLatin1String("QuickOpen"));
s->remove(QString());
......
......@@ -78,7 +78,6 @@ public slots:
void openLocator();
private slots:
void settingsLoaded();
void updatePlaceholderText(Core::Command *command = 0);
private:
......@@ -90,6 +89,7 @@ private:
LocatorWidget *m_locatorWidget;
SettingsPage *m_settingsPage;
bool m_settingsInitialized;
QList<ILocatorFilter*> m_filters;
QList<ILocatorFilter*> m_customFilters;
int m_refreshInterval;
......@@ -97,7 +97,6 @@ private:
OpenDocumentsFilter *m_openDocumentsFilter;
FileSystemFilter *m_fileSystemFilter;
ExecuteFilter *m_executeFilter;
QFutureWatcher<void> m_loadWatcher;
};
template <typename S>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment