Index: kprocio.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kprocio.cpp,v
retrieving revision 1.30
diff -u -3 -p -r1.30 kprocio.cpp
--- kprocio.cpp	10 Sep 2003 00:12:12 -0000	1.30
+++ kprocio.cpp	10 Oct 2003 19:51:40 -0000
@@ -199,7 +199,32 @@ void KProcIO::received (KProcess *, char
 void KProcIO::ackRead ()
 {
   readsignalon=true;
-  if (needreadsignal || recvbuffer.length()!=0)
+ 
+  // || recvbuffer.length() != 0
+  // removed because data in recvbuffer does not mean that there
+  // really is a line available!
+  // If _new_ data has come in, received() was called, which
+  // called controlledEmission(), which set the needreadsignal
+  // flag anyway. 
+  // If "|| recvbuffer.length() != 0" is not removed the 
+  // following situation occurs when  readln ( . , false) is used and 
+  // ackRead() is called manually:
+  // Example of use:
+  // void userReadReady( KProcIO * pio ) {
+  //   QString line;
+  //   while( (pio -> readln( line, false )) >= 0 ) {
+  //     // Process line
+  //   }
+  //   pio -> ackRead();
+  // }
+  // So the loop removes any currently available lines from the buffer.
+  // If there is still some incomplete line in the buffer, ackRead() will
+  // immediately call userReadReady() again, which cannot read anything
+  // but has to ackRead() because otherwise no signals will be delivered
+  // anymore. You will end up in endless recursion without prevention by
+  // the user. 
+    
+  if (needreadsignal /*|| recvbuffer.length()!=0*/)
      controlledEmission();
 }
 

