[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:06:16 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=557a15c

The following commit has been merged in the master branch:
commit 557a15c6c7800b2b3bddf9871a4cfa85476faec9
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Mon Jan 28 17:12:37 2013 +0000

    Use a QSharedDataPointer in message class
---
 KTp/message.cpp | 23 +++++++----------------
 KTp/message.h   |  7 ++++---
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/KTp/message.cpp b/KTp/message.cpp
index d814a99..1c898a9 100644
--- a/KTp/message.cpp
+++ b/KTp/message.cpp
@@ -18,25 +18,17 @@
 
 
 #include "message.h"
+
 #include <KDebug>
+#include <QSharedData>
 
 using namespace KTp;
 
-class Message::Private {
+class Message::Private : public QSharedData {
 
   public:
     Private()
-    { }
-
-    Private(const Private &other):
-        sentTime(other.sentTime),
-        token(other.token),
-        messageType(other.messageType),
-        properties(other.properties),
-        mainPart(other.mainPart),
-        parts(other.parts),
-        scripts(other.scripts)
-    { }
+    { };
 
     QDateTime   sentTime;
     QString     token;
@@ -48,7 +40,7 @@ class Message::Private {
 };
 
 Message::Message(const Tp::Message &original) :
-    d(new Private())
+    d(new Private)
 {
     d->sentTime = original.sent();
     d->token = original.messageToken();
@@ -58,7 +50,7 @@ Message::Message(const Tp::Message &original) :
 }
 
 Message::Message(const Tpl::TextEventPtr &original) :
-    d(new Private())
+    d(new Private)
 {
     d->sentTime = original->timestamp();
     d->token = original->messageToken();
@@ -68,13 +60,12 @@ Message::Message(const Tpl::TextEventPtr &original) :
 }
 
 Message::Message(const Message& other):
-    d(new Private(*(other.d)))
+    d(other.d)
 {
 }
 
 Message::~Message()
 {
-    delete d;
 }
 
 QString Message::mainMessagePart() const
diff --git a/KTp/message.h b/KTp/message.h
index 581a2e2..82e8e89 100644
--- a/KTp/message.h
+++ b/KTp/message.h
@@ -27,6 +27,7 @@
 
 #include <KTp/ktp-export.h>
 
+#include <QSharedDataPointer>
 
 namespace KTp
 {
@@ -42,7 +43,7 @@ namespace KTp
  *
  * 
ote
  * Methods in this class are currently *not* thread safe. They will be in a
- * later version. Setting properties concurrently is undefined. 
+ * later version. Setting properties concurrently is undefined.
  *
  * uthor Lasath Fernando <kde at lasath.org>
  */
@@ -72,7 +73,7 @@ class KTP_EXPORT Message
      * Each plugin that adds visual components should call this once thier
      * processing is complete. Once a message part is added, it cannot be
      * changed!
-     * 
+     *
      * \param part the content to be added, in valid HTML
      */
     void appendMessagePart(const QString &part);
@@ -135,7 +136,7 @@ class KTP_EXPORT Message
 
   private:
     class Private;
-    Private * const d;
+    QSharedDataPointer<Private> d;
 };
 
 }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list