diff --git a/src/librssguard-standard/src/standardserviceentrypoint.cpp b/src/librssguard-standard/src/standardserviceentrypoint.cpp index 883d978b2..5281b7cce 100644 --- a/src/librssguard-standard/src/standardserviceentrypoint.cpp +++ b/src/librssguard-standard/src/standardserviceentrypoint.cpp @@ -2,20 +2,25 @@ #include "src/standardserviceentrypoint.h" +#include "src/gui/formeditstandardaccount.h" +#include "src/standardserviceroot.h" #include #include #include -#include "src/gui/formeditstandardaccount.h" -#include "src/standardserviceroot.h" StandardServiceEntryPoint::StandardServiceEntryPoint(QObject* parent) : QObject(parent) {} +StandardServiceEntryPoint::~StandardServiceEntryPoint() { + qDebugNN << LOGSEC_CORE << "Destructing plugin."; +} + QString StandardServiceEntryPoint::name() const { return QSL("RSS/RDF/ATOM/JSON"); } QString StandardServiceEntryPoint::description() const { - return QObject::tr("This service offers integration with standard online RSS/RDF/ATOM/JSON feeds and podcasts."); + return QObject:: + tr("This service offers integration with standard online RSS/RDF/ATOM/JSON/Sitemap/iCalendar feeds and podcasts."); } QString StandardServiceEntryPoint::author() const { @@ -42,3 +47,7 @@ QList StandardServiceEntryPoint::initializeSubtree() const { return DatabaseQueries::getAccounts(database, code()); } + +bool StandardServiceEntryPoint::isDynamicallyLoaded() const { + return true; +} diff --git a/src/librssguard-standard/src/standardserviceentrypoint.h b/src/librssguard-standard/src/standardserviceentrypoint.h index 9fe67164b..2e1dc64d6 100644 --- a/src/librssguard-standard/src/standardserviceentrypoint.h +++ b/src/librssguard-standard/src/standardserviceentrypoint.h @@ -12,6 +12,7 @@ class RSSGUARD_DLLSPEC_EXPORT StandardServiceEntryPoint : public QObject, public public: explicit StandardServiceEntryPoint(QObject* parent = nullptr); + virtual ~StandardServiceEntryPoint(); virtual QString name() const; virtual QString description() const; @@ -20,6 +21,7 @@ class RSSGUARD_DLLSPEC_EXPORT StandardServiceEntryPoint : public QObject, public virtual QString code() const; virtual ServiceRoot* createNewRoot() const; virtual QList initializeSubtree() const; + virtual bool isDynamicallyLoaded() const; }; #endif // STANDARDSERVICEENTRYPOINT_H diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 954f89c15..d36269367 100644 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -300,6 +300,8 @@ void Application::performLogging(QtMsgType type, const QMessageLogContext& conte if (!s_disableDebug) { std::cerr << console_message.toStdString() << std::endl; + + std::cerr << QDir::currentPath().toStdString() << std::endl; } if (!s_customLogFile.isEmpty()) { diff --git a/src/librssguard/miscellaneous/feedreader.cpp b/src/librssguard/miscellaneous/feedreader.cpp index 16e40abff..cdb286f68 100644 --- a/src/librssguard/miscellaneous/feedreader.cpp +++ b/src/librssguard/miscellaneous/feedreader.cpp @@ -52,7 +52,17 @@ FeedReader::FeedReader(QObject* parent) FeedReader::~FeedReader() { qDebugNN << LOGSEC_CORE << "Destroying FeedReader instance."; - qDeleteAll(m_feedServices); + + for (ServiceEntryPoint* service : m_feedServices) { + if (!service->isDynamicallyLoaded()) { + qDebugNN << LOGSEC_CORE << "Deleting service" << QUOTE_W_SPACE_DOT(service->code()); + } + else { + qDebugNN << LOGSEC_CORE << "Service" << QUOTE_W_SPACE(service->code()) << "will be deleted by runtime."; + } + } + // qDeleteAll(m_feedServices); + qDeleteAll(m_messageFilters); } diff --git a/src/librssguard/miscellaneous/pluginfactory.cpp b/src/librssguard/miscellaneous/pluginfactory.cpp index 82de0ffea..817b4a0b3 100644 --- a/src/librssguard/miscellaneous/pluginfactory.cpp +++ b/src/librssguard/miscellaneous/pluginfactory.cpp @@ -27,23 +27,23 @@ QList PluginFactory::loadPlugins() const { while (dir_iter.hasNext()) { dir_iter.next(); + const QFileInfo& plugin_file = dir_iter.fileInfo(); qApp->addLibraryPath(plugin_file.absolutePath()); QDir::setCurrent(plugin_file.absolutePath()); - qDebugNN << LOGSEC_CORE << "Loading plugin" - << QUOTE_W_SPACE_DOT(QDir::toNativeSeparators(plugin_file.absoluteFilePath())); - QPluginLoader loader(plugin_file.absoluteFilePath()); ServiceEntryPoint* plugin_instance = qobject_cast(loader.instance()); + QDir::setCurrent(backup_current_dir); + if (plugin_instance == nullptr) { - qCriticalNN << LOGSEC_CORE - << "The plugin was not loaded successfully:" << QUOTE_W_SPACE_DOT(loader.errorString()); + qCriticalNN << LOGSEC_CORE << "The plugin" << QUOTE_W_SPACE(plugin_file.absoluteFilePath()) + << "was not loaded successfully:" << QUOTE_W_SPACE_DOT(loader.errorString()); } else { - qDebugNN << LOGSEC_CORE << "Plugin" << QUOTE_W_SPACE(plugin_instance->code()) << "loaded."; + qDebugNN << LOGSEC_CORE << "Plugin" << QUOTE_W_SPACE(plugin_file.absoluteFilePath()) << "loaded."; plugins.append(plugin_instance); } diff --git a/src/librssguard/services/abstract/serviceentrypoint.h b/src/librssguard/services/abstract/serviceentrypoint.h index 6d7669129..b9e37f14f 100644 --- a/src/librssguard/services/abstract/serviceentrypoint.h +++ b/src/librssguard/services/abstract/serviceentrypoint.h @@ -43,8 +43,14 @@ class RSSGUARD_DLLSPEC ServiceEntryPoint { // Icon of the service. virtual QIcon icon() const = 0; + + virtual bool isDynamicallyLoaded() const; }; +inline bool ServiceEntryPoint::isDynamicallyLoaded() const { + return false; +} + Q_DECLARE_INTERFACE(ServiceEntryPoint, "io.github.martinrotter.rssguard.serviceentrypoint") #endif // SERVICE_H