Stop copying selected_partition back on itself in the copy dialog (#750168)
The code goes like this: Dialog_Partition_Copy::Get_New_Partition() call Dialog_Base_Partition::Get_New_Partition() Update this->selected_partition with results from running the dialog. return this->selected_partition by value. Save value back to this->selected_partition. Update this->selected_partition some more. return this->selected_partition by value. So there is an unnecessary copy of the partition object returned from the base class Get_New_Partition() function back to the same variable in the derived copy class Get_New_Partition() function. Need to keep the base class Get_New_Partition() function as derived class Dialog_Partition_Resize_Move uses that implementation as it doesn't override it, and it's part of the interface. Avoid this unnecessary copy by moving base class Get_New_Partition() code into a new private function, called prepare_new_partition(), which doesn't return anything. Then have Get_New_Partition() in both classes just return the required partition object. Like this: Dialog_Base_Partition::Get_New_Partition() call prepare_new_partition() return this->selected_partition by value. Dialog_Partition_Copy::Get_New_Partition() call Dialog_Base_Partition::prepare_new_partition() Update this->selected_partition some more. return this->selected_partition by value. Bug 750168 - Reduce the amount of copying of partition objects
parent
90e3ed68
Please register or sign in to comment