DCOP ' Couldn't attach to DCOP server'

Per Winkvist per.winkvist at cell-telecom.com
Wed Oct 9 09:22:54 BST 2002


Hi,

If I start KDE and then switch to a text console or telnet to my computer and 
run dcop I always get 'Couldn't attach to DCOP server'. For a couple of 
months ago dcop spit out a message saying that I should set DISPLAY. Nowadays 
it doesn't do this. Setting the DISPLAY to :0.0 makes dcop do what I want.

The following patch sets the DISPLAY upon error and tries one more time which 
works great for me. 

Any comments  ?

	Per



Index: client/dcop.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/client/dcop.cpp,v
retrieving revision 1.30
diff -u -3 -p -r1.30 dcop.cpp
--- client/dcop.cpp     2002/10/05 15:23:07     1.30
+++ client/dcop.cpp     2002/10/09 08:19:12
@@ -457,6 +457,7 @@ void runDCOP( QCStringList args, UserLis
     }
 
     bool firstRun = true;
+    bool triedDisplay = false;
     UserList::Iterator it;
     QStringList sessions;
     bool presetDCOPServer = false;
@@ -624,11 +625,17 @@ void runDCOP( QCStringList args, UserLis
            bool success = client->attach();
            if( !success )
            {
-               cerr_ << "ERROR: Couldn't attach to DCOP server!" << endl;
-               if( users.isEmpty() )
-                   break;
-               else
-                   continue;
+               if ( !triedDisplay ) {
+                   setenv( "DISPLAY", ":0.0", 0 );
+                   triedDisplay = true;
+               }
+               else {
+                   cerr_ << "ERROR: Couldn't attach to DCOP server!" << endl;
+                   if( users.isEmpty() )
+                       break;
+               }
+
+               continue;
            }
            dcop = client;
 
@@ -689,6 +696,9 @@ void runDCOP( QCStringList args, UserLis
        if( it == users.end() )
            break;
     }
+
+    if ( triedDisplay )
+       unsetenv( "DISPLAY" );
 }
 





More information about the kde-core-devel mailing list