Browse Source

Only instantiate SearchPluginManager as needed

adaptive-webui-19844
Thomas Piccirello 6 years ago
parent
commit
4885fe6b4c
  1. 3
      src/app/application.cpp
  2. 8
      src/base/search/searchpluginmanager.cpp
  3. 1
      src/base/search/searchpluginmanager.h

3
src/app/application.cpp

@ -515,7 +515,6 @@ int Application::exec(const QStringList &params) @@ -515,7 +515,6 @@ int Application::exec(const QStringList &params)
new RSS::Session; // create RSS::Session singleton
new RSS::AutoDownloader; // create RSS::AutoDownloader singleton
new SearchPluginManager;
#ifdef DISABLE_GUI
#ifndef DISABLE_WEBUI
@ -710,7 +709,6 @@ void Application::cleanup() @@ -710,7 +709,6 @@ void Application::cleanup()
delete m_webui;
#endif
delete SearchPluginManager::instance();
delete RSS::AutoDownloader::instance();
delete RSS::Session::instance();
@ -726,6 +724,7 @@ void Application::cleanup() @@ -726,6 +724,7 @@ void Application::cleanup()
delete m_fileLogger;
Logger::freeInstance();
IconProvider::freeInstance();
SearchPluginManager::freeInstance();
Utils::Fs::removeDirRecursive(Utils::Fs::tempPath());
#ifndef DISABLE_GUI

8
src/base/search/searchpluginmanager.cpp

@ -101,9 +101,17 @@ SearchPluginManager::~SearchPluginManager() @@ -101,9 +101,17 @@ SearchPluginManager::~SearchPluginManager()
SearchPluginManager *SearchPluginManager::instance()
{
if (!m_instance)
m_instance = new SearchPluginManager;
return m_instance;
}
void SearchPluginManager::freeInstance()
{
if (m_instance)
delete m_instance;
}
QStringList SearchPluginManager::allPlugins() const
{
return m_plugins.keys();

1
src/base/search/searchpluginmanager.h

@ -62,6 +62,7 @@ public: @@ -62,6 +62,7 @@ public:
~SearchPluginManager() override;
static SearchPluginManager *instance();
static void freeInstance();
QStringList allPlugins() const;
QStringList enabledPlugins() const;

Loading…
Cancel
Save