From a2dab822e759efc363617274c459d0ba8f260c13 Mon Sep 17 00:00:00 2001 From: webzuweb Date: Fri, 11 Sep 2026 16:19:27 +0300 Subject: [PATCH] fix: typo Slop->Slot and mark Signal::subscribe() [[nodiscard]] - Fix doc comment "Signal/Slop implementation" -> "Signal/Slot implementation" - Mark subscribe() [[nodiscard]]: the returned shared_ptr is the only strong reference keeping the subscription alive (subscribers_ stores weak_ptrs), so discarding it silently drops the subscription before it can ever fire. Closes #1159 --- include/behaviortree_cpp/utils/signal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/behaviortree_cpp/utils/signal.h b/include/behaviortree_cpp/utils/signal.h index a49d7e605..fc1a0c28d 100644 --- a/include/behaviortree_cpp/utils/signal.h +++ b/include/behaviortree_cpp/utils/signal.h @@ -8,7 +8,7 @@ namespace BT { /** - * Super simple Signal/Slop implementation, AKA "Observable pattern". + * Super simple Signal/Slot implementation, AKA "Observable pattern". * The subscriber is active until it goes out of scope or Subscriber::reset() is called. */ template @@ -34,7 +34,7 @@ class Signal } } - Subscriber subscribe(CallableFunction func) + [[nodiscard]] Subscriber subscribe(CallableFunction func) { Subscriber sub = std::make_shared(std::move(func)); subscribers_.emplace_back(sub);