From 084d96943c561b19b3e1b327b219e37e89dadff2 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Wed, 16 Oct 2024 17:02:11 +0200 Subject: [PATCH] Fix DataReaderHistory regression (#5327) * Refs #21694. Turn assertion into condition. Signed-off-by: Miguel Company * Refs #21694. Fix uncrustify. Signed-off-by: Miguel Company --------- Signed-off-by: Miguel Company (cherry picked from commit 837c6c8ea26637212724a55f1fb1489172dc6d93) --- src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp index ac9e6bfebcd..f800c0832b5 100644 --- a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp +++ b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp @@ -867,10 +867,8 @@ bool DataReaderHistory::update_instance_nts( change->reader_info.no_writers_generation_count = vit->second->no_writers_generation_count; auto current_owner = vit->second->current_owner.first; - if (current_owner != previous_owner) + if ((current_owner != previous_owner) && (current_owner == change->writerGUID)) { - assert(current_owner == change->writerGUID); - // Remove all changes from different owners after the change. DataReaderInstance::ChangeCollection& changes = vit->second->cache_changes; auto it = std::lower_bound(changes.begin(), changes.end(), change, rtps::history_order_cmp);