[gparted] Stop copying displayed partition objects in activate_resize() (#750168)



commit 7f05037dbc99e957d6ec15499eeb42e6786605f9
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat May 23 11:34:08 2015 +0100

    Stop copying displayed partition objects in activate_resize() (#750168)
    
    The first actions of Win_GParted::activate_resize() were to create a
    copy of the vector of partitions for the currently displayed device and
    visually apply any pending operations.  Exactly this has already been
    done in Win_GParted::Refresh_Visual() with the result now available in
    the member variable display_partitions.  Stop this unnecessary partition
    object copying and processing by just using display_partitions member
    variable instead.
    
    Bug 750168 - Reduce the amount of copying of partition objects

 src/Win_GParted.cc |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 6b9bd0d..b4ba88b 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1712,23 +1712,17 @@ void Win_GParted::activate_resize()
        g_assert( selected_partition_ptr != NULL );  // Bug: Partition callback without a selected partition
        g_assert( valid_display_partition_ptr( selected_partition_ptr ) );  // Bug: Not pointing at a valid 
display partition object
 
-       std::vector<Partition> partitions = devices[ current_device ] .partitions ;
-       
-       if ( operations .size() )
-               for (unsigned int t = 0 ; t < operations .size() ; t++ )
-                       if ( operations[ t ] ->device == devices[ current_device ] )
-                               operations[ t ] ->apply_to_visual( partitions ) ;
-
        Dialog_Partition_Resize_Move dialog( gparted_core.get_fs( selected_partition_ptr->filesystem ) );
 
        if ( selected_partition_ptr->type == TYPE_LOGICAL )
        {
                unsigned int ext = 0 ;
-               while ( ext < partitions .size() && partitions[ ext ] .type != GParted::TYPE_EXTENDED ) ext++ 
;
-               dialog.Set_Data( *selected_partition_ptr, partitions[ext].logicals );
+               while ( ext < display_partitions.size() && display_partitions[ext].type != TYPE_EXTENDED )
+                       ext++;
+               dialog.Set_Data( *selected_partition_ptr, display_partitions[ext].logicals );
        }
        else
-               dialog.Set_Data( *selected_partition_ptr, partitions );
+               dialog.Set_Data( *selected_partition_ptr, display_partitions );
 
        dialog .set_transient_for( *this ) ;    
                        


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