Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions droneapi/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ def notify_observers(self, attr_name):
except Exception as e:
print("Error calling observer: ", e)

def remove_all_observers(self):
"""
Internal function. Do not use.

This method removes all attached observers.

.. INTERNAL NOTE: (For subclass use only)
"""
self.__observers = {}

class Vehicle(HasObservers):
"""
The main vehicle API
Expand Down
5 changes: 5 additions & 0 deletions droneapi/module/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ def run(self):
self.module.mpstate.rx_blacklist.remove('STATUSTEXT')
except:
pass # Silently work with old mavproxies

# Remove all observers.
self.module.vehicle.remove_all_observers()
self.module.vehicle.unset_mavlink_callback()

self.module.thread_remove(self)

def __str__(self):
Expand Down