From 19d9b6d358b90141393632a216ff07ad9d71c298 Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Wed, 7 Jan 2015 16:29:25 -0500
Subject: [PATCH] [ #63393 ] Fix some Krazy2 warnings

---
 src/abstractitembackendmodelextension.cpp      |  2 +-
 src/abstractitembackendmodelextension.h        |  4 ++--
 src/accountmodel.h                             |  5 ++---
 src/audio/alsapluginmodel.h                    |  2 +-
 src/audio/inputdevicemodel.h                   |  2 +-
 src/audio/managermodel.h                       |  2 +-
 src/audio/outputdevicemodel.h                  |  2 +-
 src/audio/ringtonedevicemodel.h                |  2 +-
 src/audio/settings.h                           |  2 +-
 src/contact.h                                  |  4 ++--
 .../presenceitembackendmodelextension.h        |  4 ++--
 src/hookmanager.h                              |  2 +-
 src/imconversationmanager.cpp                  |  4 ++--
 src/imconversationmanager.h                    |  4 ++--
 src/instantmessagingmodel.cpp                  |  2 +-
 src/instantmessagingmodel.h                    |  2 +-
 src/keyexchangemodel.cpp                       |  2 +-
 src/keyexchangemodel.h                         |  2 +-
 src/lastusednumbermodel.cpp                    |  2 +-
 src/lastusednumbermodel.h                      |  2 +-
 src/numbercategorymodel.cpp                    |  2 +-
 src/numbercategorymodel.h                      |  2 +-
 src/numbercompletionmodel.cpp                  |  1 -
 src/private/call_p.h                           |  4 ++--
 src/private/instantmessagingmodel_p.h          |  4 ++--
 src/private/phonedirectorymodel_p.h            |  4 ++--
 src/private/videochannel_p.h                   |  2 +-
 src/private/videocodec_p.h                     |  2 +-
 src/private/videodevice_p.h                    |  2 +-
 src/securityvalidationmodel.h                  |  2 +-
 src/uri.cpp                                    | 18 +++++++++---------
 src/uri.h                                      |  7 ++++---
 src/useractionmodel.h                          |  2 +-
 src/video/channel.cpp                          |  3 +--
 src/video/channel.h                            |  2 +-
 src/video/codecmodel2.cpp                      |  2 +-
 src/video/codecmodel2.h                        |  6 +++---
 src/video/device.cpp                           |  2 +-
 src/video/device.h                             |  2 +-
 src/video/devicemodel.cpp                      |  2 +-
 src/video/devicemodel.h                        |  2 +-
 src/video/manager.cpp                          |  8 ++++----
 src/video/manager.h                            |  6 +++---
 src/video/sourcesmodel.h                       |  4 ++--
 src/visitors/numbercategoryvisitor.cpp         |  2 +-
 src/visitors/presenceserializationvisitor.cpp  |  2 +-
 46 files changed, 73 insertions(+), 75 deletions(-)

diff --git a/src/abstractitembackendmodelextension.cpp b/src/abstractitembackendmodelextension.cpp
index 8e8f5aad..b9dd74ef 100644
--- a/src/abstractitembackendmodelextension.cpp
+++ b/src/abstractitembackendmodelextension.cpp
@@ -21,4 +21,4 @@
 AbstractItemBackendModelExtension::AbstractItemBackendModelExtension(QObject* parent) : QObject(parent)
 {
    
-}
\ No newline at end of file
+}
diff --git a/src/abstractitembackendmodelextension.h b/src/abstractitembackendmodelextension.h
index 547a5c50..4fb81c2e 100644
--- a/src/abstractitembackendmodelextension.h
+++ b/src/abstractitembackendmodelextension.h
@@ -30,7 +30,7 @@ class LIB_EXPORT AbstractItemBackendModelExtension : public QObject
    Q_OBJECT
 
 public:
-   AbstractItemBackendModelExtension(QObject* parent);
+   explicit AbstractItemBackendModelExtension(QObject* parent);
 
    virtual QVariant      data    (AbstractContactBackend* backend, const QModelIndex& index, int role = Qt::DisplayRole      ) const = 0;
    virtual Qt::ItemFlags flags   (AbstractContactBackend* backend, const QModelIndex& index                                  ) const = 0;
@@ -41,4 +41,4 @@ Q_SIGNALS:
    void dataChanged(const QModelIndex& idx);
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/accountmodel.h b/src/accountmodel.h
index 513b33fa..851fdb8f 100644
--- a/src/accountmodel.h
+++ b/src/accountmodel.h
@@ -16,9 +16,8 @@
  *   You should have received a copy of the GNU General Public License      *
  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
  ***************************************************************************/
-
-#ifndef ACCOUNT_LIST_H
-#define ACCOUNT_LIST_H
+#ifndef ACCOUNTMODEL_H
+#define ACCOUNTMODEL_H
 
 
 #include <QtCore/QVector>
diff --git a/src/audio/alsapluginmodel.h b/src/audio/alsapluginmodel.h
index 5920fb34..fde12a40 100644
--- a/src/audio/alsapluginmodel.h
+++ b/src/audio/alsapluginmodel.h
@@ -59,4 +59,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/audio/inputdevicemodel.h b/src/audio/inputdevicemodel.h
index 56005852..01c3ca3e 100644
--- a/src/audio/inputdevicemodel.h
+++ b/src/audio/inputdevicemodel.h
@@ -59,4 +59,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/audio/managermodel.h b/src/audio/managermodel.h
index 1e46caf0..6b5a2f9e 100644
--- a/src/audio/managermodel.h
+++ b/src/audio/managermodel.h
@@ -70,4 +70,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/audio/outputdevicemodel.h b/src/audio/outputdevicemodel.h
index f55ba9d8..ac6572ae 100644
--- a/src/audio/outputdevicemodel.h
+++ b/src/audio/outputdevicemodel.h
@@ -59,4 +59,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/audio/ringtonedevicemodel.h b/src/audio/ringtonedevicemodel.h
index 646e21aa..2250e96f 100644
--- a/src/audio/ringtonedevicemodel.h
+++ b/src/audio/ringtonedevicemodel.h
@@ -59,4 +59,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/audio/settings.h b/src/audio/settings.h
index 88ee2bc7..db915732 100644
--- a/src/audio/settings.h
+++ b/src/audio/settings.h
@@ -115,4 +115,4 @@ private:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/contact.h b/src/contact.h
index 1f654f4b..b6fee3e8 100644
--- a/src/contact.h
+++ b/src/contact.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- *   Copyright (C) 2009-2015 by Savoir-Faire Linux                          *
+ *   Copyright (C) 2009-2014 by Savoir-Faire Linux                          *
  *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>          *
  *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
  *                                                                          *
@@ -154,7 +154,7 @@ protected:
 class LIB_EXPORT ContactPlaceHolder : public Contact {
    Q_OBJECT
 public:
-   ContactPlaceHolder(const QByteArray& uid);
+   explicit ContactPlaceHolder(const QByteArray& uid);
    bool merge(Contact* contact);
 };
 
diff --git a/src/extensions/presenceitembackendmodelextension.h b/src/extensions/presenceitembackendmodelextension.h
index 57104e79..9c92ecd7 100644
--- a/src/extensions/presenceitembackendmodelextension.h
+++ b/src/extensions/presenceitembackendmodelextension.h
@@ -32,7 +32,7 @@ class LIB_EXPORT PresenceItemBackendModelExtension : public AbstractItemBackendM
    Q_OBJECT
 
 public:
-   PresenceItemBackendModelExtension(QObject* parent);
+   explicit PresenceItemBackendModelExtension(QObject* parent);
 
    virtual QVariant      data    (AbstractContactBackend* backend, const QModelIndex& index, int role = Qt::DisplayRole      ) const override;
    virtual Qt::ItemFlags flags   (AbstractContactBackend* backend, const QModelIndex& index                                  ) const override;
@@ -40,4 +40,4 @@ public:
    virtual QString       headerName() const override;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/hookmanager.h b/src/hookmanager.h
index 2b247052..8754d333 100644
--- a/src/hookmanager.h
+++ b/src/hookmanager.h
@@ -64,4 +64,4 @@ private:
    static HookManager* m_spInstance;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/imconversationmanager.cpp b/src/imconversationmanager.cpp
index 71e85c41..91d1ad1b 100644
--- a/src/imconversationmanager.cpp
+++ b/src/imconversationmanager.cpp
@@ -58,14 +58,14 @@ IMConversationManager* IMConversationManager::instance()
 
 IMConversationManager::~IMConversationManager()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 ///Constructor
 IMConversationManager::IMConversationManager() : QObject(nullptr), d_ptr(new IMConversationManagerPrivate(this))
 {
    CallManagerInterface& callManager = DBus::CallManager::instance();
-   connect(&callManager, SIGNAL(incomingMessage(QString,QString,QString)), d_ptr, SLOT(newMessage(QString,QString,QString)));
+   connect(&callManager, SIGNAL(incomingMessage(QString,QString,QString)), d_ptr.data(), SLOT(newMessage(QString,QString,QString)));
 }
 
 ///Called when a new message is incoming
diff --git a/src/imconversationmanager.h b/src/imconversationmanager.h
index ab9cfef5..8a9caeee 100644
--- a/src/imconversationmanager.h
+++ b/src/imconversationmanager.h
@@ -45,7 +45,7 @@ private:
    explicit IMConversationManager();
    virtual ~IMConversationManager();
 
-   IMConversationManagerPrivate* d_ptr;
+   const QScopedPointer<IMConversationManagerPrivate> d_ptr;
    Q_DECLARE_PRIVATE(IMConversationManager)
 
    //Static attributes
@@ -57,4 +57,4 @@ Q_SIGNALS:
    void newMessagingModel(Call*,InstantMessagingModel*);
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp
index cced5846..9d747a1a 100644
--- a/src/instantmessagingmodel.cpp
+++ b/src/instantmessagingmodel.cpp
@@ -45,7 +45,7 @@ InstantMessagingModel::InstantMessagingModel(Call* call, QObject* par) : QAbstra
 
 InstantMessagingModel::~InstantMessagingModel()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 ///Get data from the model
diff --git a/src/instantmessagingmodel.h b/src/instantmessagingmodel.h
index 1ecd86f7..38e74449 100644
--- a/src/instantmessagingmodel.h
+++ b/src/instantmessagingmodel.h
@@ -66,7 +66,7 @@ public:
    virtual bool  setData  ( const QModelIndex& index, const QVariant &value, int role)       override;
 
 private:
-   InstantMessagingModelPrivate* d_ptr;
+   const QScopedPointer<InstantMessagingModelPrivate> d_ptr;
    Q_DECLARE_PRIVATE(InstantMessagingModel)
 };
 #endif
diff --git a/src/keyexchangemodel.cpp b/src/keyexchangemodel.cpp
index 3a598200..1db20559 100644
--- a/src/keyexchangemodel.cpp
+++ b/src/keyexchangemodel.cpp
@@ -50,7 +50,7 @@ KeyExchangeModel::KeyExchangeModel(Account* account) : QAbstractListModel(accoun
 
 KeyExchangeModel::~KeyExchangeModel()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 //Model functions
diff --git a/src/keyexchangemodel.h b/src/keyexchangemodel.h
index 361a96cc..c24c73c5 100644
--- a/src/keyexchangemodel.h
+++ b/src/keyexchangemodel.h
@@ -89,7 +89,7 @@ public:
 
 
 private:
-   KeyExchangeModelPrivate* d_ptr;
+   QScopedPointer<KeyExchangeModelPrivate> d_ptr;
 
 public Q_SLOTS:
    void enableSRTP(bool enable);
diff --git a/src/lastusednumbermodel.cpp b/src/lastusednumbermodel.cpp
index a79728f0..1d688acf 100644
--- a/src/lastusednumbermodel.cpp
+++ b/src/lastusednumbermodel.cpp
@@ -56,7 +56,7 @@ LastUsedNumberModel::LastUsedNumberModel() : QAbstractListModel(),d_ptr(new Last
 
 LastUsedNumberModel::~LastUsedNumberModel()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 LastUsedNumberModel* LastUsedNumberModel::instance()
diff --git a/src/lastusednumbermodel.h b/src/lastusednumbermodel.h
index 52bf2ced..0909cdfe 100644
--- a/src/lastusednumbermodel.h
+++ b/src/lastusednumbermodel.h
@@ -49,7 +49,7 @@ private:
    explicit LastUsedNumberModel();
    virtual ~LastUsedNumberModel();
 
-   LastUsedNumberModelPrivate* d_ptr;
+   QScopedPointer<LastUsedNumberModelPrivate> d_ptr;
    Q_DECLARE_PRIVATE(LastUsedNumberModel)
 
    //Static attributes
diff --git a/src/numbercategorymodel.cpp b/src/numbercategorymodel.cpp
index 42c9f85b..d2565023 100644
--- a/src/numbercategorymodel.cpp
+++ b/src/numbercategorymodel.cpp
@@ -45,7 +45,7 @@ NumberCategoryModel::NumberCategoryModel(QObject* parent) : QAbstractListModel(p
 
 NumberCategoryModel::~NumberCategoryModel()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 //Abstract model member
diff --git a/src/numbercategorymodel.h b/src/numbercategorymodel.h
index 92e03786..8f836c34 100644
--- a/src/numbercategorymodel.h
+++ b/src/numbercategorymodel.h
@@ -64,7 +64,7 @@ private:
    explicit NumberCategoryModel(QObject* parent = nullptr);
    ~NumberCategoryModel();
 
-   NumberCategoryModelPrivate* d_ptr;
+   QScopedPointer<NumberCategoryModelPrivate> d_ptr;
 
    //Singleton
    static NumberCategoryModel* m_spInstance;
diff --git a/src/numbercompletionmodel.cpp b/src/numbercompletionmodel.cpp
index 0a198e5e..3ff05276 100644
--- a/src/numbercompletionmodel.cpp
+++ b/src/numbercompletionmodel.cpp
@@ -342,4 +342,3 @@ bool NumberCompletionModel::isUsingUnregisteredAccounts()
 }
 
 #include <numbercompletionmodel.moc>
-
diff --git a/src/private/call_p.h b/src/private/call_p.h
index ac4590eb..e6f33980 100644
--- a/src/private/call_p.h
+++ b/src/private/call_p.h
@@ -96,7 +96,7 @@ public:
       constexpr static const char* OUTGOING = "1";
    };
 
-   CallPrivate(Call* parent);
+   explicit CallPrivate(Call* parent);
 
    //Attributes
    Account*                 m_Account         ;
@@ -223,4 +223,4 @@ private Q_SLOTS:
    void updated();
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/private/instantmessagingmodel_p.h b/src/private/instantmessagingmodel_p.h
index 794d7639..dace08f0 100644
--- a/src/private/instantmessagingmodel_p.h
+++ b/src/private/instantmessagingmodel_p.h
@@ -27,7 +27,7 @@ class InstantMessagingModelPrivate : public QObject
 {
    Q_OBJECT
 public:
-   InstantMessagingModelPrivate(InstantMessagingModel* parent);
+   explicit InstantMessagingModelPrivate(InstantMessagingModel* parent);
 
    //Private members
    void addIncommingMessage(const QString& from, const QString& message);
@@ -47,4 +47,4 @@ private:
    InstantMessagingModel* q_ptr;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/private/phonedirectorymodel_p.h b/src/private/phonedirectorymodel_p.h
index 634d63c8..9c1fe9a0 100644
--- a/src/private/phonedirectorymodel_p.h
+++ b/src/private/phonedirectorymodel_p.h
@@ -33,7 +33,7 @@ class PhoneDirectoryModelPrivate : public QObject
 {
    Q_OBJECT
 public:
-   PhoneDirectoryModelPrivate(PhoneDirectoryModel* parent);
+   explicit PhoneDirectoryModelPrivate(PhoneDirectoryModel* parent);
 
 
    //Model columns
@@ -84,4 +84,4 @@ private Q_SLOTS:
    void slotNewBuddySubscription(const QString& uri, const QString& accountId, bool status, const QString& message);
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/private/videochannel_p.h b/src/private/videochannel_p.h
index 3659b797..e2d5e679 100644
--- a/src/private/videochannel_p.h
+++ b/src/private/videochannel_p.h
@@ -28,4 +28,4 @@ public:
    Video::Device*              m_pDevice;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/private/videocodec_p.h b/src/private/videocodec_p.h
index ea7bafa0..0316dc47 100644
--- a/src/private/videocodec_p.h
+++ b/src/private/videocodec_p.h
@@ -43,4 +43,4 @@ public:
    QString          m_Parameters;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/private/videodevice_p.h b/src/private/videodevice_p.h
index 716d6a0c..8f8f4019 100644
--- a/src/private/videodevice_p.h
+++ b/src/private/videodevice_p.h
@@ -37,4 +37,4 @@ public:
    QList<Video::Channel*> m_lChannels      ;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/securityvalidationmodel.h b/src/securityvalidationmodel.h
index d0b47270..101c5dad 100644
--- a/src/securityvalidationmodel.h
+++ b/src/securityvalidationmodel.h
@@ -156,7 +156,7 @@ public:
    SecurityValidationModel::Severity severity() const;
 private:
    //Constructor
-   Flaw(SecurityValidationModel::SecurityFlaw f,Certificate::Type type = Certificate::Type::NONE)
+   explicit Flaw(SecurityValidationModel::SecurityFlaw f,Certificate::Type type = Certificate::Type::NONE)
    : m_flaw(f),m_certType(type),m_Row(-1)
    {
       m_severity = SecurityValidationModel::flawSeverity[f];
diff --git a/src/uri.cpp b/src/uri.cpp
index 8d38657c..a1338fd2 100644
--- a/src/uri.cpp
+++ b/src/uri.cpp
@@ -33,7 +33,7 @@ public:
    bool             m_Parsed      ;
 
    //Helper
-   static QString strip(const QString& uri, URI::SchemeType& sheme);
+   static QString strip(const QString& uri, URI::SchemeType& scheme);
    void parse();
 private:
    QString* q_ptr;
@@ -64,7 +64,7 @@ URI::~URI()
 {
    (*static_cast<QString*>(this)) = QString();
    d_ptr->m_Stripped = QString();
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 URI& URI::operator=(const URI& o)
@@ -80,18 +80,18 @@ URI& URI::operator=(const URI& o)
 }
 
 ///Strip out <sip:****> from the URI
-QString URIPrivate::strip(const QString& uri, URI::SchemeType& sheme)
+QString URIPrivate::strip(const QString& uri, URI::SchemeType& scheme)
 {
    if (uri.isEmpty())
       return QString();
    int start(0),end(uri.size()-1); //Other type of comparisons were too slow
    if (end > 5 && uri[0] == '<' ) {
       if (uri[4] == ':') {
-         sheme = uri[1] == 's'?URI::SchemeType::SIP : URI::SchemeType::IAX;
+         scheme = uri[1] == 's'?URI::SchemeType::SIP : URI::SchemeType::IAX;
          start = 5;
       }
       else if (uri[5] == ':') {
-         sheme = URI::SchemeType::SIPS;
+         scheme = URI::SchemeType::SIPS;
          start = 6;
       }
    }
@@ -122,9 +122,9 @@ bool URI::hasHostname() const
 void URIPrivate::parse()
 {
    if (q_ptr->indexOf('@') != -1) {
-      const QStringList splitted = q_ptr->split('@');
-      m_Hostname = splitted[1];//splitted[1].left(splitted[1].size())
-      m_Userinfo = splitted[0];
+      const QStringList split = q_ptr->split('@');
+      m_Hostname = split[1];//split[1].left(split[1].size())
+      m_Userinfo = split[0];
       m_Parsed = true;
    }
 }
@@ -144,4 +144,4 @@ QString URI::fullUri() const
    return QString("<%1%2>")
       .arg(schemeNames[static_cast<int>(d_ptr->m_HeaderType == SchemeType::NONE?SchemeType::SIP:d_ptr->m_HeaderType)])
       .arg(*this);
-}
\ No newline at end of file
+}
diff --git a/src/uri.h b/src/uri.h
index 6732b568..8322b3aa 100644
--- a/src/uri.h
+++ b/src/uri.h
@@ -25,7 +25,7 @@
 class URIPrivate;
 
 /**
-    * @class URI A specialised string with multiple attributes
+    * @class URI A specialized string with multiple attributes
     * 
     * Most of SFLPhone-KDE handle uri as strings, but more
     * advanced algorithms need to access the various sections.
@@ -117,9 +117,10 @@ public:
    bool    hasHostname() const;
 
    URI& operator=(const URI&);
+
 private:
-   URIPrivate* d_ptr;
+   const QScopedPointer<URIPrivate> d_ptr;
 };
 // Q_DECLARE_METATYPE(URI*)
 
-#endif //URI_H
\ No newline at end of file
+#endif //URI_H
diff --git a/src/useractionmodel.h b/src/useractionmodel.h
index 97e4cca8..7ba93947 100644
--- a/src/useractionmodel.h
+++ b/src/useractionmodel.h
@@ -97,7 +97,7 @@ public:
    bool isAcceptEnabled  () const;
 
 private:
-   UserActionModelPrivate* d_ptr;
+   const QScopedPointer<UserActionModelPrivate> d_ptr;
    Q_DECLARE_PRIVATE(UserActionModel)
 
 Q_SIGNALS:
diff --git a/src/video/channel.cpp b/src/video/channel.cpp
index d22ffa23..59de066e 100644
--- a/src/video/channel.cpp
+++ b/src/video/channel.cpp
@@ -37,7 +37,7 @@ d_ptr(new VideoChannelPrivate())
 
 Video::Channel::~Channel()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 QVariant Video::Channel::data( const QModelIndex& index, int role) const
@@ -122,4 +122,3 @@ Video::Device* Video::Channel::device() const
 {
    return d_ptr->m_pDevice;
 }
-
diff --git a/src/video/channel.h b/src/video/channel.h
index 67fb0ef7..162747ed 100644
--- a/src/video/channel.h
+++ b/src/video/channel.h
@@ -55,7 +55,7 @@ private:
    Channel(Video::Device* dev,const QString& name);
    virtual ~Channel();
 
-   VideoChannelPrivate* d_ptr;
+   QScopedPointer<VideoChannelPrivate> d_ptr;
 };
 
 }
diff --git a/src/video/codecmodel2.cpp b/src/video/codecmodel2.cpp
index 715c7b1c..1f3b942c 100644
--- a/src/video/codecmodel2.cpp
+++ b/src/video/codecmodel2.cpp
@@ -54,7 +54,7 @@ Video::CodecModel2::~CodecModel2()
       d_ptr->m_lCodecs.removeAt(0);
       delete c;
    }
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 ///Get data from the model
diff --git a/src/video/codecmodel2.h b/src/video/codecmodel2.h
index 14a730a7..75ee9630 100644
--- a/src/video/codecmodel2.h
+++ b/src/video/codecmodel2.h
@@ -15,8 +15,8 @@
  *   You should have received a copy of the GNU General Public License      *
  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
  ***************************************************************************/
-#ifndef VIDEOCODECMODEL_H
-#define VIDEOCODECMODEL_H
+#ifndef CODECMODEL2_H
+#define CODECMODEL2_H
 
 #include "../typedefs.h"
 #include <QtCore/QAbstractListModel>
@@ -65,7 +65,7 @@ public:
    bool moveDown(const QModelIndex& idx);
 
 private:
-   CodecModelPrivate* d_ptr;
+   QScopedPointer<CodecModelPrivate> d_ptr;
 
 };
 
diff --git a/src/video/device.cpp b/src/video/device.cpp
index d08a026e..b22a0d0d 100644
--- a/src/video/device.cpp
+++ b/src/video/device.cpp
@@ -63,7 +63,7 @@ d_ptr(new VideoDevicePrivate())
 ///Destructor
 Video::Device::~Device()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 QVariant Video::Device::data( const QModelIndex& index, int role) const
diff --git a/src/video/device.h b/src/video/device.h
index 9d75e1d5..2f1cf6d1 100644
--- a/src/video/device.h
+++ b/src/video/device.h
@@ -86,7 +86,7 @@ class LIB_EXPORT Device : public QAbstractListModel {
       explicit Device(const QString& id);
       virtual ~Device();
 
-      VideoDevicePrivate* d_ptr;
+      QScopedPointer<VideoDevicePrivate> d_ptr;
 
 
    Q_SIGNALS:
diff --git a/src/video/devicemodel.cpp b/src/video/devicemodel.cpp
index b422c716..8f4f0a16 100644
--- a/src/video/devicemodel.cpp
+++ b/src/video/devicemodel.cpp
@@ -100,7 +100,7 @@ Video::DeviceModel::~DeviceModel()
       d_ptr->m_lDevices.removeAt(0);
       delete c;
    }
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 ///Save the current model over dbus
diff --git a/src/video/devicemodel.h b/src/video/devicemodel.h
index a550dbab..314d1ebc 100644
--- a/src/video/devicemodel.h
+++ b/src/video/devicemodel.h
@@ -59,7 +59,7 @@ public:
    QList<Video::Device*> devices() const;
 
 private:
-   DeviceModelPrivate* d_ptr;
+   const QScopedPointer<DeviceModelPrivate> d_ptr;
    static DeviceModel* m_spInstance;
 
 public Q_SLOTS:
diff --git a/src/video/manager.cpp b/src/video/manager.cpp
index 663eeb90..01ef8008 100644
--- a/src/video/manager.cpp
+++ b/src/video/manager.cpp
@@ -71,15 +71,15 @@ m_BufferSize(0),m_ShmKey(0),m_SemKey(0),m_PreviewState(false),m_SSMutex(new QMut
 Video::Manager::Manager():QThread(), d_ptr(new Video::ManagerPrivate(this))
 {
    VideoManagerInterface& interface = DBus::VideoManager::instance();
-   connect( &interface , SIGNAL(deviceEvent())                           , d_ptr, SLOT(deviceEvent())                           );
-   connect( &interface , SIGNAL(startedDecoding(QString,QString,int,int,bool)), d_ptr, SLOT(startedDecoding(QString,QString,int,int)));
-   connect( &interface , SIGNAL(stoppedDecoding(QString,QString,bool))        , d_ptr, SLOT(stoppedDecoding(QString,QString))        );
+   connect( &interface , SIGNAL(deviceEvent())                           , d_ptr.data(), SLOT(deviceEvent())                           );
+   connect( &interface , SIGNAL(startedDecoding(QString,QString,int,int,bool)), d_ptr.data(), SLOT(startedDecoding(QString,QString,int,int)));
+   connect( &interface , SIGNAL(stoppedDecoding(QString,QString,bool))        , d_ptr.data(), SLOT(stoppedDecoding(QString,QString))        );
 }
 
 
 Video::Manager::~Manager()
 {
-   delete d_ptr;
+//    delete d_ptr;
 }
 
 ///Singleton
diff --git a/src/video/manager.h b/src/video/manager.h
index 1d84cb64..818afd25 100644
--- a/src/video/manager.h
+++ b/src/video/manager.h
@@ -15,8 +15,8 @@
  *   You should have received a copy of the Lesser GNU General Public License *
  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.    *
  *****************************************************************************/
-#ifndef VIDEO_MODEL_H
-#define VIDEO_MODEL_H
+#ifndef MANAGER_H
+#define MANAGER_H
 //Base
 #include "../typedefs.h"
 #include <QtCore/QThread>
@@ -65,7 +65,7 @@ private:
    explicit Manager();
    virtual ~Manager();
 
-   ManagerPrivate* d_ptr;
+   QScopedPointer<ManagerPrivate> d_ptr;
    Q_DECLARE_PRIVATE(Manager)
 
    //Static attributes
diff --git a/src/video/sourcesmodel.h b/src/video/sourcesmodel.h
index fd8d4f78..afe1e80b 100644
--- a/src/video/sourcesmodel.h
+++ b/src/video/sourcesmodel.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- *   Copyright (C) 2014-2015 by Savoir-Faire Linux                          *
+ *   Copyright (C) 2014 by Savoir-Faire Linux                               *
  *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
  *                                                                          *
  *   This library is free software; you can redistribute it and/or          *
@@ -65,4 +65,4 @@ public Q_SLOTS:
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/visitors/numbercategoryvisitor.cpp b/src/visitors/numbercategoryvisitor.cpp
index 4be8eddc..7d8b4c55 100644
--- a/src/visitors/numbercategoryvisitor.cpp
+++ b/src/visitors/numbercategoryvisitor.cpp
@@ -50,4 +50,4 @@ void NumberCategoryVisitor::setInstance(NumberCategoryVisitor* ins)
 {
    m_spInstance = ins;
    ins->load(NumberCategoryModel::instance());
-}
\ No newline at end of file
+}
diff --git a/src/visitors/presenceserializationvisitor.cpp b/src/visitors/presenceserializationvisitor.cpp
index 8889ae6b..26ea038a 100644
--- a/src/visitors/presenceserializationvisitor.cpp
+++ b/src/visitors/presenceserializationvisitor.cpp
@@ -62,4 +62,4 @@ void PresenceSerializationVisitor::setInstance(PresenceSerializationVisitor* ins
 {
    m_spInstance = ins;
    ins->load();
-}
\ No newline at end of file
+}
-- 
GitLab