From 36480add4993a9252c427d92aa7e68a4f3f7f32b Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Tue, 22 Oct 2024 15:27:20 -0400 Subject: [PATCH] Fix: cpp-common/bt2: Pointer comparison in ConstErrorIterator `operator==()` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `_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 --- src/cpp-common/bt2/error.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.34.1