Commit 656ec1a
committed
fix(ros2): address Copilot round-2 review on PR #9745
Follow-up to 7e5d2d2 that closes the remaining races and semantics
bugs surfaced by Copilot's second pass:
* SubscriberImpl::GetMessage: clear _new_message under _message_mutex
so on_data_available cannot drop a pending sample by racing the
flag-clear against its own store(true). Same fix applied to the
on_data_available side: the lock now spans both the _message write
and the flag store.
* SubscriberImpl::on_subscription_matched and
PublisherImpl::on_publication_matched: derive _alive from
info.current_count > 0, not info.total_count > 0. total_count is
cumulative and never decrements, so the previous code latched
IsAlive() to true forever after the first match.
* ROS2::AddActorRosName: insert_or_assign so a re-registered actor
actually picks up its new ros_name. The previous unordered_map
::insert silently kept the stale entry.1 parent 9f18588 commit 656ec1a
3 files changed
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 144 | + | |
| 145 | + | |
149 | 146 | | |
150 | 147 | | |
151 | 148 | | |
| |||
0 commit comments