From c1b960f003ffe78e164e25739de87a02614c8ddd Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Tue, 31 Jan 2012 11:54:36 +0100 Subject: [PATCH] small cleanup --- src/core/plugins/plugins.cpp | 6 +++++- src/core/plugins/plugins.h | 2 +- src/core/plugins/snorebackend.cpp | 2 +- src/core/plugins/snorebackend.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/plugins/plugins.cpp b/src/core/plugins/plugins.cpp index 7ac7de3..bd4ec0b 100644 --- a/src/core/plugins/plugins.cpp +++ b/src/core/plugins/plugins.cpp @@ -25,7 +25,7 @@ namespace Snore{ -SnorePlugin::SnorePlugin ( QString name ) : +SnorePlugin::SnorePlugin ( const QString &name ) : m_name ( name ), m_initialized(false) {} @@ -37,6 +37,10 @@ SnorePlugin::~SnorePlugin() bool SnorePlugin::init( SnoreCore *snore ) { + if(m_initialized){ + qFatal("Something went wrong, plugin %s is already initialized",this->name().toLatin1().constData()); + return false; + } qDebug()<<"Initialize"<m_snore = snore; m_initialized = true; diff --git a/src/core/plugins/plugins.h b/src/core/plugins/plugins.h index c981dd0..20530c2 100644 --- a/src/core/plugins/plugins.h +++ b/src/core/plugins/plugins.h @@ -31,7 +31,7 @@ class SNORE_EXPORT SnorePlugin:public QObject { Q_OBJECT public: - SnorePlugin ( QString name); + SnorePlugin ( const QString &name); virtual ~SnorePlugin(); virtual bool init( SnoreCore* snore ); bool isInitialized(); diff --git a/src/core/plugins/snorebackend.cpp b/src/core/plugins/snorebackend.cpp index 42c288e..d910563 100644 --- a/src/core/plugins/snorebackend.cpp +++ b/src/core/plugins/snorebackend.cpp @@ -25,7 +25,7 @@ namespace Snore{ -SnoreBackend::SnoreBackend ( QString name ) : +SnoreBackend::SnoreBackend ( const QString &name ) : SnorePlugin ( name ) { diff --git a/src/core/plugins/snorebackend.h b/src/core/plugins/snorebackend.h index bae257e..84b9a11 100644 --- a/src/core/plugins/snorebackend.h +++ b/src/core/plugins/snorebackend.h @@ -32,7 +32,7 @@ class SNORE_EXPORT SnoreBackend:public SnorePlugin Q_OBJECT Q_INTERFACES(Snore::SnorePlugin) public: - SnoreBackend ( QString name ); + SnoreBackend(const QString &name ); virtual ~SnoreBackend(); virtual bool init(SnoreCore *snore);