[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kde4/playground/libs/qt-dbus
From:       Thiago Macieira <thiago () kde ! org>
Date:       2006-04-26 12:30:59
Message-ID: 1146054659.522570.3390.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 534111 by thiago:

Don't keep the connection names, since this is unreliable and requires
the event loop to be spun (in order to receive the signals from the
bus).

Instead, trust the unique connection name.


 M  +0 -4      qdbusconnection.cpp  
 M  +0 -3      qdbusconnection_p.h  
 M  +3 -13     qdbusintegrator.cpp  


--- branches/work/kde4/playground/libs/qt-dbus/qdbusconnection.cpp #534110:534111
@@ -298,10 +298,6 @@
         d->busService = new QDBusBusService(p);
         d->busService->setParent(d); // auto-deletion
         d->ref.deref();              // busService has a increased the refcounting \
                to us
-
-        d->connect(d->busService, SIGNAL(nameAcquired(QString)), \
                SLOT(nameAcquired(QString)));
-        d->connect(d->busService, SIGNAL(nameLost(QString)), \
                SLOT(nameLost(QString)));
-        d->myNames += retval.baseService();
     }
 
     return retval;
--- branches/work/kde4/playground/libs/qt-dbus/qdbusconnection_p.h #534110:534111
@@ -181,8 +181,6 @@
     void socketWrite(int);
     void objectDestroyed(QObject *o);
     void relaySignal(QObject *obj, const char *interface, const char *name, const \
                QVariantList &args);
-    void nameAcquired(const QString &service);
-    void nameLost(const QString &service);
 
 public:
     // public member variables
@@ -197,7 +195,6 @@
     DBusConnection *connection;
     DBusServer *server;
     QDBusBusService *busService;
-    QSet<QString> myNames;
 
     WatcherHash watchers;
     TimeoutHash timeouts;
--- branches/work/kde4/playground/libs/qt-dbus/qdbusintegrator.cpp #534110:534111
@@ -957,18 +957,6 @@
     dbus_message_unref(msg);
 }
 
-void QDBusConnectionPrivate::nameAcquired(const QString &service)
-{
-    QWriteLocker locker(&lock);
-    myNames += service;
-}
-
-void QDBusConnectionPrivate::nameLost(const QString &service)
-{
-    QWriteLocker locker(&lock);
-    myNames -= service;
-}
-
 int QDBusConnectionPrivate::registerMessageMetaType()
 {
     int tp = messageMetaType = qRegisterMetaType<QDBusMessage>("QDBusMessage");
@@ -1519,6 +1507,7 @@
     QString owner = getNameOwner(service);
     if (connection && !owner.isEmpty() && QDBusUtil::isValidObjectPath(path) &&
         (interface.isEmpty() || QDBusUtil::isValidInterfaceName(interface)))
+        // always call here with the unique connection name
         mo = findMetaObject(owner, path, interface);
 
     QDBusInterfacePrivate *p = new QDBusInterfacePrivate(QDBusConnection(name), \
this, owner, path, interface, mo); @@ -1560,13 +1549,14 @@
 QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &path,
                                        const QString &interface)
 {
+    // service must be a unique connection name
     if (!interface.isEmpty()) {
         QReadLocker locker(&lock);
         QDBusMetaObject *mo = cachedMetaObjects.value(interface, 0);
         if (mo)
             return mo;
     }
-    if (myNames.contains(service)) {
+    if (service == QString::fromUtf8(dbus_bus_get_unique_name(connection))) {
         // it's one of our own
         QWriteLocker locker(&lock);
         QDBusMetaObject *mo = 0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic