[gparted] Stop copying selected partition object in Manage Flags dialog (#750168)



commit ece945685ca71c0adef42f3e4bd71c8ba6e381e1
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun May 24 12:33:34 2015 +0100

    Stop copying selected partition object in Manage Flags dialog (#750168)
    
    When opening the Manage Flags dialog, creation of the dialog object was
    creating a copy of the selected partition object.  If this was an
    extended partition it also included recursively constructing the
    contained logical partitions too.
    
    Instead, replace the partition object in the DialogManageFlags class
    with a reference to it.
    
    Bug 750168 - Reduce the amount of copying of partition objects

 include/DialogManageFlags.h |    2 +-
 src/DialogManageFlags.cc    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/include/DialogManageFlags.h b/include/DialogManageFlags.h
index 43fc9d3..a7c90fd 100644
--- a/include/DialogManageFlags.h
+++ b/include/DialogManageFlags.h
@@ -60,7 +60,7 @@ private:
        } ;
        treeview_flags_Columns treeview_flags_columns ; 
 
-       Partition partition ;
+       const Partition & partition;  // (Alias to element in Win_GParted::display_partitions[] vector).
        std::map<Glib::ustring, bool> flag_info ;
 };
 
diff --git a/src/DialogManageFlags.cc b/src/DialogManageFlags.cc
index 350f85f..d8e0fd1 100644
--- a/src/DialogManageFlags.cc
+++ b/src/DialogManageFlags.cc
@@ -23,7 +23,8 @@
 namespace GParted
 {
 
-DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib::ustring, bool> flag_info )
+DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib::ustring, bool> flag_info ) 
:
+                                    partition( partition )
 {
        any_change = false ;
 
@@ -51,7 +52,6 @@ DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib
        treeview_flags .set_size_request( 300, -1 ) ;
        get_vbox() ->pack_start( treeview_flags, Gtk::PACK_SHRINK ) ;
 
-       this ->partition = partition ;
        this ->flag_info = flag_info ;
        
        load_treeview() ;


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