Fixing crash when core logging was enabled
The operator=() function tried to use the "=" operator to copy the
entire structure at once, which of course called the same function
again, leading to infinite recursion, and thus, segfault.
Worked around this braino by simply copying each field individually,
forgoing the convenience of copying the structure as a whole.
Tested: Use of the core logging feature no longer crashes
Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: Id472d03409296a45bb14180f5c1897dfb42be1aa
diff --git a/pid/ec/logging.hpp b/pid/ec/logging.hpp
index 3cbd714..3cef589 100644
--- a/pid/ec/logging.hpp
+++ b/pid/ec/logging.hpp
@@ -74,7 +74,13 @@
{
if (this != &move)
{
- *this = std::move(move);
+ // Move each field individually
+ nameOriginal = std::move(move.nameOriginal);
+ nameClean = std::move(move.nameClean);
+ fileContext = std::move(move.fileContext);
+ fileCoeffs = std::move(move.fileCoeffs);
+ lastLog = std::move(move.lastLog);
+ lastContext = std::move(move.lastContext);
// Mark the moved object, so destructor knows it was moved
move.moved = true;