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

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdeprint
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2007-06-15 16:45:03
Message-ID: 20070615164503.GB13893 () ugly ! local
[Download RAW message or body]

On Fri, Jun 15, 2007 at 04:02:14PM +0000, Andreas Pakulat wrote:
> --- trunk/KDE/kdelibs/kdeprint/tools/escputil/escpwidget.cpp #675966:675967
> @@ -247,14 +247,16 @@
>  
>  void EscpWidget::slotReceivedStdout()
>  {
> -	QByteArray bufstr = m_proc.readAllStandardOutput();
> -	m_outbuffer.append( QString::fromLocal8Bit( bufstr ) );
> +	while( m_proc.canReadLine() )
> +		m_outbuffer.append( QString::fromLocal8Bit( m_proc.readLine() ) );
>  }
>  
ok, that's fine in theory (except that you don't handle a possible
final unterminated line, but that's an unlikely event, i suppose).

in practice, there is a problem if a line arrives in multiple segments
and meanwhile data arrives on the other channel ... qprocess discards
the remaining read buffer on switching channels (including
readAllStandard*()). that means that always draining the entire buffer
and doing line splitting yourself is the only safe option when you have
configured SeparateChannels. oh, btw, tt is denying that this is a bug -
but hey, they accepted it as an enhancement.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
[prev in list] [next in list] [prev in thread] [next in thread] 

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