mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(uorb): keep shared topics advertised on publisher teardown (#29176)
* fix(dataman_client): keep request topic advertised on client teardown * fix(uorb): keep shared topics advertised on publisher teardown Single-instance publications share one advertised flag, so destroying one publisher must not hide updates from the others. Keep automatic unadvertising in PublicationMultiBase and remove the DatamanClient workaround. Cover surviving publishers and instance reuse, and reset retained input samples between test cases. Tested: make tests (215/215), make format. Signed-off-by: jonas <jonas.perolini@rigi.tech> Assisted-by: Codex * docs(uorb): correct unadvertise comments and document teardown The unadvertise comment claimed it has no effect on single-instance topics, which is how one publisher's teardown came to hide the others. State what clearing the shared flag does, and document that only PublicationMulti releases its instance on destruction. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: jonas <jonas.perolini@rigi.tech> * test(uorb): keep test cases independent of retained samples A destroyed single-instance publication now leaves its last sample visible, so ManualControlTest, test_prec_takeoff and mixer_module_tests passed only in declaration order and failed under --gtest_shuffle. Reset with an inert sample where one exists, otherwise unadvertise the test's own publications, and drop module outputs left over from a previous case. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: jonas <jonas.perolini@rigi.tech> * fix(boards): drop the PublicationBase destructor from the ITCM lists The destructor is now trivial and no longer emitted, so itcm_check.py fails on the missing section. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> --------- Signed-off-by: jonas <jonas.perolini@rigi.tech> Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> Co-authored-by: jonas <jonas.perolini@rigi.tech> Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
18 files changed
+118
-20
No files matched your search
@@ -304,15 +304,9 @@ int uORB::DeviceNode::unadvertise(orb_advert_t handle)
|
||||
uORB::DeviceNode *devnode = (uORB::DeviceNode *)handle;
|
||||
|
||||
/*
|
||||
* We are cheating a bit here. First, with the current implementation, we can only
|
||||
* have multiple publishers for instance 0. In this case the caller will have
|
||||
* instance=nullptr and _published has no effect at all. Thus no unadvertise is
|
||||
* necessary.
|
||||
* In case of multiple instances, we have at most 1 publisher per instance and
|
||||
* we can signal an instance as 'free' by setting _published to false.
|
||||
* We never really free the DeviceNode, for this we would need reference counting
|
||||
* of subscribers and publishers. But we also do not have a leak since future
|
||||
* publishers reuse the same DeviceNode object.
|
||||
* Frees a multi-instance node for the next advertiser and hides it from all subscribers.
|
||||
* Publishers of a single-instance topic share this flag, so unadvertising hides all of them.
|
||||
* The DeviceNode is never freed; later publishers reuse it.
|
||||
*/
|
||||
devnode->_advertised.store(false);
|
||||
|
||||
|
||||
Reference in new issue
Block a user