[gparted/psusi/refactor] fixup! Reduce threading (#685740)



commit 7818c9238831b4188d203bfd838cf88f51e26606
Author: Phillip Susi <psusi ubuntu com>
Date:   Thu Feb 28 21:53:37 2013 -0500

    fixup! Reduce threading (#685740)
    
    Correct the way execute_command adds the operation details to the stack,
    and fix OperationDetail::get_last_child() to not return a temporary copy.

 src/FileSystem.cc      |   10 +++++-----
 src/OperationDetail.cc |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/FileSystem.cc b/src/FileSystem.cc
index 0895bd0..14d93f5 100644
--- a/src/FileSystem.cc
+++ b/src/FileSystem.cc
@@ -112,11 +112,11 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
        PipeCapture errorcapture( err, error );
        outputcapture.eof.connect( sigc::mem_fun( *this, &FileSystem::execute_command_eof ) );
        errorcapture.eof.connect( sigc::mem_fun( *this, &FileSystem::execute_command_eof ) );
-       operationdetail.add_child(
+       operationdetail.get_last_child().add_child(
                OperationDetail( output, STATUS_NONE, FONT_ITALIC ) );
-       operationdetail.add_child(
+       operationdetail.get_last_child().add_child(
                OperationDetail( error, STATUS_NONE, FONT_ITALIC ) );
-       std::vector<OperationDetail> &children = operationdetail.get_childs();
+       std::vector<OperationDetail> &children = operationdetail.get_last_child().get_childs();
        outputcapture.update.connect( sigc::bind( sigc::ptr_fun( relay_update ),
                                                  &(children[children.size() - 2]),
                                                  &output ) );
@@ -135,9 +135,9 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
 
        if (checkstatus) {
                if ( !exit_status )
-                       children[children.size() - 3].set_status( STATUS_SUCCES );
+                       operationdetail.get_last_child().set_status( STATUS_SUCCES );
                else
-                       children[children.size() - 3].set_status( STATUS_ERROR );
+                       operationdetail.get_last_child().set_status( STATUS_ERROR );
        }
        close( out );
        close( err );
diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc
index 5eb5ec3..f366d60 100644
--- a/src/OperationDetail.cc
+++ b/src/OperationDetail.cc
@@ -147,7 +147,7 @@ OperationDetail & OperationDetail::get_last_child()
        if ( sub_details .size() == 0 )
                add_child( OperationDetail( "---", STATUS_ERROR ) ) ;
 
-       return sub_details .back() ;
+       return sub_details[sub_details.size() - 1];
 }
 
 void OperationDetail::on_update( const OperationDetail & operationdetail ) 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]