Skip to content
Commit 545b75d9 authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Move vector of partition objects to a Win_GParted class member (#750168)

Win_GParted::Refresh_Visual() used a local variable containing a copy of
the vector of partitions in the current device to be displayed.  After
visually applying pending operations it loaded copies of each partition
object into the GUI widgets to display the disk graphic and partition
list, DrawingAreaVisualDisk and TreeView_Details classes respectively.
When a partition is selected in the UI, again a partition object is
copied.  Also several of the partition dialogs, including the
information dialog, take a copy of the partition object.  All these are
copies of the same set of partition objects, those currently being
displayed in the UI.

Move the vector of displayed partitions from a local variable in
Refresh_Visual() to a Win_GParted member variable.  This will allow for
the above cases to be changed to used pointers and references to the
same set of partition objects.

The valid lifetime of pointers to elements in this partition object
vector is from one refresh to the next, when the vector is cleared and
repopulated with a new set of partition objects.  This is exactly what
is needed as the GUI widgets are reloaded on each refresh, the selected
partition is reset and none of the partition dialog objects exist.
Dialog objects being created and destroyed on each use.

On the other hand some copies of partition objects currently being
displayed, still need to be made because they have lifetimes which need
to last longer than the next call to Refresh_Visual().  Specifically the
source of the copy partition and the partition objects copied into the
in the list of pending operations.

Bug 750168 - Reduce the amount of copying of partition objects
parent 7090866b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment