From: Kienan Stewart Date: Tue, 22 Oct 2024 19:27:20 +0000 (-0400) Subject: Fix: cpp-common/bt2: Pointer comparison in ConstErrorIterator `operator==()` X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=36480add4993a9252c427d92aa7e68a4f3f7f32b;p=babeltrace.git Fix: cpp-common/bt2: Pointer comparison in ConstErrorIterator `operator==()` `_mError` and `other._mError` are pointers already. Before this change, using the iterator would assert at run-time, e.g. 10-22 15:30:52.152 2434504 2434504 D LIB/CUR-THREAD bt_current_thread_take_error@lib/current-thread.c:36 Took current thread's error object: addr=0x210c19a0 (╯°□°)╯︵ ┻━┻ ../src/cpp-common/bt2/error.hpp:229: operator==(): Assertion `&other._mError == &_mError` failed. Aborted Signed-off-by: Jérémie Galarneau Signed-off-by: Kienan Stewart Change-Id: I678b7542e0c94e16e404519a39356079b3719401 Reviewed-on: https://review.lttng.org/c/babeltrace/+/13389 Tested-by: jenkins Reviewed-by: Philippe Proulx --- diff --git a/src/cpp-common/bt2/error.hpp b/src/cpp-common/bt2/error.hpp index d4dfeaac..785cd0c7 100644 --- a/src/cpp-common/bt2/error.hpp +++ b/src/cpp-common/bt2/error.hpp @@ -226,7 +226,7 @@ private: public: bool operator==(const ConstErrorIterator& other) const noexcept { - BT_ASSERT(&other._mError == &_mError); + BT_ASSERT(other._mError == _mError); return other._mIndex == _mIndex; }