Move initial clearing of output capture buffers into PipeCapture class (#777973)
Seems more logical to initially clear the output capture buffer in a single location in the PipeCapture class which reads the command output into said buffer, rather than each calling site before the PipeCapture objects are constructed. Bug 777973 - Segmentation fault on bad disk
This commit is contained in:
parent
a03735ac6f
commit
a233e30efe
|
@ -133,8 +133,6 @@ int FileSystem::execute_command_internal( const Glib::ustring & command, Operati
|
|||
fcntl( out, F_SETFL, O_NONBLOCK );
|
||||
fcntl( err, F_SETFL, O_NONBLOCK );
|
||||
Glib::signal_child_watch().connect( sigc::mem_fun( *this, &FileSystem::store_exit_status ), pid );
|
||||
output.clear();
|
||||
error.clear();
|
||||
pipecount = 2;
|
||||
PipeCapture outputcapture( out, output );
|
||||
PipeCapture errorcapture( err, error );
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace GParted {
|
|||
PipeCapture::PipeCapture( int fd, Glib::ustring &string ) : buff( string ),
|
||||
linestart( 0 ), cursor( 0 ), lineend( 0 )
|
||||
{
|
||||
buff.clear();
|
||||
// tie fd to string
|
||||
// make channel
|
||||
channel = Glib::IOChannel::create_from_fd( fd );
|
||||
|
|
|
@ -601,8 +601,6 @@ int Utils::execute_command( const Glib::ustring & command,
|
|||
fcntl( out, F_SETFL, O_NONBLOCK );
|
||||
fcntl( err, F_SETFL, O_NONBLOCK );
|
||||
g_child_watch_add( pid, _store_exit_status, &status );
|
||||
output.clear();
|
||||
error.clear();
|
||||
//Lock mutex so we have time to setup pipecapture for output and error streams
|
||||
// before connecting the input/output signal handler
|
||||
if( !status.foreground )
|
||||
|
|
Loading…
Reference in New Issue