1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Only instantiate SearchPluginManager as needed

This commit is contained in:
Thomas Piccirello 2018-11-20 22:58:26 -05:00
parent d05897c89a
commit 4885fe6b4c
3 changed files with 10 additions and 2 deletions

View File

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

View File

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

View File

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