diff --git a/include/Partition.h b/include/Partition.h index 26a11df4..495843de 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -113,7 +113,7 @@ public: const Glib::ustring& get_path() const; void add_mountpoint( const Glib::ustring & mountpoint ); void add_mountpoints( const std::vector & mountpoints ); - Glib::ustring get_mountpoint() const ; + const Glib::ustring& get_mountpoint() const; void clear_mountpoints() ; std::vector get_mountpoints() const ; Sector get_sector() const ; diff --git a/src/Dialog_Rescue_Data.cc b/src/Dialog_Rescue_Data.cc index e3a343af..541d5e78 100644 --- a/src/Dialog_Rescue_Data.cc +++ b/src/Dialog_Rescue_Data.cc @@ -264,7 +264,7 @@ void Dialog_Rescue_Data::check_overlaps(int nPart) for(unsigned int i=0;ioverlappedPartitions.size(); i++) { const Glib::ustring& ovrDevPath = this->device->partitions[i].get_path(); - Glib::ustring ovrDevMountPoint=this->device->partitions[i].get_mountpoint(); + const Glib::ustring& ovrDevMountPoint = this->device->partitions[i].get_mountpoint(); sec_text+="\n"+ovrDevPath+" mounted on "+ovrDevMountPoint; } @@ -275,7 +275,7 @@ void Dialog_Rescue_Data::check_overlaps(int nPart) { for(unsigned int i=0;ioverlappedPartitions.size(); i++) { - Glib::ustring mountP=this->device->partitions[i].get_mountpoint(); + const Glib::ustring& mountP=this->device->partitions[i].get_mountpoint(); Glib::ustring commandUmount = "umount " + Glib::shell_quote(mountP); Utils::execute_command(commandUmount); diff --git a/src/Partition.cc b/src/Partition.cc index bef26dd1..f3a83f9a 100644 --- a/src/Partition.cc +++ b/src/Partition.cc @@ -364,12 +364,14 @@ void Partition::add_mountpoints( const std::vector & mountpoints this ->mountpoints .insert( this ->mountpoints .end(), mountpoints .begin(), mountpoints .end() ) ; } -Glib::ustring Partition::get_mountpoint() const + +const Glib::ustring& Partition::get_mountpoint() const { if ( mountpoints .size() > 0 ) return mountpoints .front() ; - return "" ; + static Glib::ustring unknown_mountpoint; + return unknown_mountpoint; } std::vector Partition::get_mountpoints() const