From 4532d9cf784a85c899161a9b82e7d65814269f92 Mon Sep 17 00:00:00 2001 From: Alberto Soragna Date: Thu, 6 Jun 2019 21:56:50 +0100 Subject: [PATCH] checking origin of intra-process msg before taking them (#753) Signed-off-by: alberto --- rclcpp/include/rclcpp/subscription.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rclcpp/include/rclcpp/subscription.hpp b/rclcpp/include/rclcpp/subscription.hpp index 0ba293e..6b394a2 100644 --- a/rclcpp/include/rclcpp/subscription.hpp +++ b/rclcpp/include/rclcpp/subscription.hpp @@ -170,6 +170,13 @@ public: // However, this can only really happen if this node has it disabled, but the other doesn't. return; } + + if (!matches_any_intra_process_publishers(&message_info.publisher_gid)) { + // This intra-process message has not been created by a publisher from this context. + // we should ignore this copy of the message. + return; + } + if (any_callback_.use_take_shared_method()) { ConstMessageSharedPtr msg; take_intra_process_message(