From 4298a1320bdbd9e5486ba92f709e9ae8aec59bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Mon, 5 Jul 2021 07:38:34 +0200 Subject: [PATCH] Refs #11676. Fix bug using not protected code in a test (#2036) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- test/blackbox/api/dds-pim/PubSubWriterReader.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/blackbox/api/dds-pim/PubSubWriterReader.hpp b/test/blackbox/api/dds-pim/PubSubWriterReader.hpp index 5924278e105..f8515960653 100644 --- a/test/blackbox/api/dds-pim/PubSubWriterReader.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriterReader.hpp @@ -418,8 +418,9 @@ class PubSubWriterReader if (ret_val) { std::string topic_name = topic_name_; + size_t vector_size = entities_extra_.size(); - for (size_t i = 0; i < entities_extra_.size(); i++) + for (size_t i = 0; i < vector_size; i++) { topic_name += "/"; } @@ -451,7 +452,9 @@ class PubSubWriterReader break; } + mutex_.lock(); entities_extra_.push_back({topic, datawriter, datareader}); + mutex_.unlock(); } }