SdBusError: Fix missing move
Our move operator and constructor currently forgets that it needs to
also move the value of the system_error. It also needs to initialize the
error member since the move function will first free the current error.
Tested:
Builds still work and existing tests pass.
Change-Id: I72fcd2d10eeedf6edf6f83c10ddaf15bb42c8b0d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/sdbusplus/exception.cpp b/sdbusplus/exception.cpp
index 2bb3576..f13ba86 100644
--- a/sdbusplus/exception.cpp
+++ b/sdbusplus/exception.cpp
@@ -40,7 +40,8 @@
populateMessage(prefix);
}
-SdBusError::SdBusError(SdBusError&& other)
+SdBusError::SdBusError(SdBusError&& other) :
+ std::system_error(std::move(other)), error(SD_BUS_ERROR_NULL)
{
move(std::move(other));
}
@@ -49,6 +50,7 @@
{
if (this != &other)
{
+ std::system_error::operator=(std::move(other));
move(std::move(other));
}
return *this;