commit 6d2747acb6e760ba1c68a7096bface8de50a0504 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Tue Apr 8 17:31:48 2025 +0200
Add move constructor and assignment operator for Inset This is useless in practice, but Coverity Scan wants it. --- src/insets/Inset.cpp | 15 +++++++++++++++ src/insets/Inset.h | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index c3efc2b5f2..f55c3e65d7 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -185,6 +185,21 @@ static void build_translator() passed = true; } +Inset & Inset::operator=(Inset const & in) +{ + if (&in != this) + buffer_ = nullptr; + return *this; +} + + +Inset & Inset::operator=(Inset && in) +{ + if (&in != this) + buffer_ = nullptr; + return *this; +} + void Inset::setBuffer(Buffer & buffer) { diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 226732b413..d41c339ebb 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -634,7 +634,10 @@ public: protected: /// Constructors Inset(Buffer * buf) : buffer_(buf) {} - Inset(Inset const &) : buffer_(0) {} + Inset(Inset const &) : buffer_(nullptr) {} + Inset(Inset &&) : buffer_(nullptr) {} + Inset & operator=(Inset const &); + Inset & operator=(Inset &&); /// replicate ourselves friend class InsetList; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs