From 1d6abdf72ccce7964ccb6b7b5bbcd3d469a2b54c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Aug 2020 23:39:12 +0200 Subject: Fix self-assignment --- .clang-tidy | 1 - src/server/UndoStack.hpp | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index d4fc88ec..a8b382bf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,7 +14,6 @@ Checks: > -bugprone-suspicious-string-compare, -cert-dcl50-cpp, -cert-err34-c, - -cert-oop54-cpp, -clang-analyzer-alpha.*, -clang-analyzer-core.CallAndMessage, -clang-analyzer-optin.cplusplus.VirtualCall, diff --git a/src/server/UndoStack.hpp b/src/server/UndoStack.hpp index 26334aeb..22d48379 100644 --- a/src/server/UndoStack.hpp +++ b/src/server/UndoStack.hpp @@ -54,10 +54,12 @@ public: ~Entry() { clear(); } Entry& operator=(const Entry& rhs) { - clear(); - time = rhs.time; - for (const LV2_Atom* ev : rhs.events) { - push_event(ev); + if (&rhs != this) { + clear(); + time = rhs.time; + for (const LV2_Atom* ev : rhs.events) { + push_event(ev); + } } return *this; } -- cgit v1.2.1