[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:04:44 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=c09e835

The following commit has been merged in the master branch:
commit c09e835cde4fed26de626c4c71485c2c724524ba
Author: Dario Freddi <drf at kde.org>
Date:   Sun Apr 18 15:21:07 2010 +0000

     * Add a real singleton guarded by K_GLOBAL_STATIC to NepomukSignalWatcher
     * Delete correctly Soprano model
    
    Signed-off-by: Dario Freddi <dario.freddi at collabora.co.uk>
    
    svn path=/trunk/playground/network/telepathy-contactlist/; revision=1116070
---
 nepomuk-signal-watcher.cpp | 45 ++++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/nepomuk-signal-watcher.cpp b/nepomuk-signal-watcher.cpp
index b350b38..a98e186 100644
--- a/nepomuk-signal-watcher.cpp
+++ b/nepomuk-signal-watcher.cpp
@@ -22,22 +22,43 @@
 #include "nepomuk-signal-watcher.h"
 
 #include <KDebug>
+#include <KGlobal>
 
 #include <Nepomuk/ResourceManager>
 
 #include <Soprano/Node>
 #include <Soprano/Statement>
 
-NepomukSignalWatcher* NepomukSignalWatcher::s_self = 0;
+class NepomukSignalWatcherHelper
+{
+public:
+    NepomukSignalWatcherHelper() : q(0) {}
+    ~NepomukSignalWatcherHelper() {
+        delete q;
+    }
+    NepomukSignalWatcher *q;
+};
+
+K_GLOBAL_STATIC(NepomukSignalWatcherHelper, s_globalNepomukSignalWatcher)
+
+NepomukSignalWatcher *NepomukSignalWatcher::instance()
+{
+    if (!s_globalNepomukSignalWatcher->q) {
+        new NepomukSignalWatcher;
+    }
+
+    return s_globalNepomukSignalWatcher->q;
+}
 
 NepomukSignalWatcher::NepomukSignalWatcher()
  : m_sopranoModel(new Soprano::Util::SignalCacheModel(
             Nepomuk::ResourceManager::instance()->mainModel()))
 {
-    kDebug();
-
     // Set up the singleton instance
-    s_self = this;
+    Q_ASSERT(!s_globalNepomukSignalWatcher->q);
+    s_globalNepomukSignalWatcher->q = this;
+
+    kDebug();
 
     // Connect to the slots we need to monitor from the Soprano Model.
     connect(m_sopranoModel,
@@ -49,21 +70,7 @@ NepomukSignalWatcher::~NepomukSignalWatcher()
 {
     kDebug();
 
-    delete m_sopranoModel;
-
-    // Delete the singleton instance of this class
-    s_self = 0;
-}
-
-NepomukSignalWatcher *NepomukSignalWatcher::instance()
-{
-    // Construct the singleton if hasn't been already
-    if (!s_self) {
-        s_self = new NepomukSignalWatcher;
-    }
-
-    // Return the singleton instance of this class
-    return s_self;
+    m_sopranoModel->deleteLater();
 }
 
 void NepomukSignalWatcher::onStatementAdded(const Soprano::Statement &statement)

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list