Fix: cpp-common/bt2: Pointer comparison in ConstErrorIterator `operator==()`
authorKienan Stewart <kstewart@efficios.com>
Tue, 22 Oct 2024 19:27:20 +0000 (15:27 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 13 Nov 2024 19:55:05 +0000 (14:55 -0500)
`_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 <jgalar@efficios.com>
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Change-Id: I678b7542e0c94e16e404519a39356079b3719401
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13389
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cpp-common/bt2/error.hpp

index d4dfeaac25807e75f8ee8febac5d0dc3f31dde3f..785cd0c748f5ee04e1120395e4d2a300f985dc4f 100644 (file)
@@ -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;
     }
 
This page took 0.025374 seconds and 4 git commands to generate.