system/uorb: uorb listener bug fix. #3361
Open
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed the issue that instance+1 subscription will be triggered when topic exists in this core
Summary
This patch fixes a critical bug in the uORB listener that caused incorrect instance numbering when iterating through topic instances.
In the listener_generate_object_list() function, when checking for the existence of the next topic instance, the code incorrectly used post-increment (instance++) instead of pre-increment (++instance). This caused the following issues:
When a topic exists in the current core (e.g., instance 0), the orb_exists() check would use the current instance value first, then increment it
This resulted in checking instance 0 twice and skipping to instance 2, missing instance 1 entirely
The subscription would incorrectly trigger for instance+1 instead of the expected next instance
Impact
Fixed: Correct instance enumeration when listening to multi-instance topics
Testing