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

List:       kde-core-devel
Subject:    PATCH: dcopClient::setNotifications()
From:       Malte.Starostik () t-online ! de (Malte Starostik)
Date:       2001-06-13 4:04:57
[Download RAW message or body]

Hi,

as it is now, setNotifications(bool) sets the app's notification interest to 
the given value. This breaks if there are multiple objects (especially parts, 
where it's rather unpredictable) that all call this method. The attached 
patch keeps notifications enabled until setNotifications() has been called 
with a false argument as often as it was called with a true argument. 
Otherwise there might be objects waiting for a notification and never get one 
:(
Please review.
Thanks,
-Malte
-- 
Wars don't determine who's right, only who's left.
["dcop.diff" (text/plain)]

Index: dcopserver.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopserver.cpp,v
retrieving revision 1.125
diff -u -3 -d -p -r1.125 dcopserver.cpp
--- dcopserver.cpp	2001/05/20 02:49:43	1.125
+++ dcopserver.cpp	2001/06/13 04:00:32
@@ -396,7 +396,7 @@ DCOPConnection::DCOPConnection( IceConn 
 			   QSocketNotifier::Read, 0, 0 )
 {
     iceConn = conn;
-    notifyRegister = false;
+    notifyRegister = 0;
     _signalConnectionList = 0;
     daemon = false;
     outputBlocked = false;
@@ -1481,8 +1481,12 @@ bool DCOPServer::receive(const QCString 
 	    Q_INT8 notifyActive;
 	    args >> notifyActive;
 	    DCOPConnection* conn = clients.find( iceConn );
-	    if ( conn )
-		conn->notifyRegister = (notifyActive != 0);
+	    if ( conn ) {
+		if ( notifyActive )
+		    conn->notifyRegister++;
+		else if ( conn->notifyRegister > 0 )
+		    conn->notifyRegister--;
+	    }
 	    replyType = "void";
 	    return TRUE;
 	}
Index: dcopserver.h
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopserver.h,v
retrieving revision 1.26
diff -u -3 -d -p -r1.26 dcopserver.h
--- dcopserver.h	2001/03/10 06:59:28	1.26
+++ dcopserver.h	2001/06/13 04:00:32
@@ -72,7 +72,7 @@ public:
     QCString appId;
     QCString plainAppId;
     IceConn iceConn;
-    bool notifyRegister;
+    int notifyRegister;
     /**
      * When client A has called client B then for the duration of the call:
      * A->waitingOnReply contains B 


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

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