diff options
author | Sven Gothel <[email protected]> | 2020-06-29 04:44:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-29 04:44:18 +0200 |
commit | 9d61d4e283b2bed9bbee6440d28862167496bbbe (patch) | |
tree | 3b7396e4ef7336b03e946e41e71d738e50e13aca /api | |
parent | dfdfd883f52e8d31c005d0f8ae42bbe6dd60c2b8 (diff) |
Resolve circular references (p2): Java DBTDevice, GATTHandler, GATTService, pp are not owner of their resepctive backreference
Even though the Java GC is capable to resolve circular references
as long they are not specifically being hold by a running thread,
we use WeakReference for a more clean lifecycle description.
This is aligned to the C++ changes of commit dfdfd883f52e8d31c005d0f8ae42bbe6dd60c2b8
Further, also have 'DBTDevice -> DBTAdapter' backreference being weak for completion.
Further, DBTDevice.remove() also removes itself from DBTAdapter's discoveredDevice list.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/GATTCharacteristic.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/GATTDescriptor.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/GATTHandler.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/GATTService.hpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/api/direct_bt/GATTCharacteristic.hpp b/api/direct_bt/GATTCharacteristic.hpp index 16aecb1a..39f132fc 100644 --- a/api/direct_bt/GATTCharacteristic.hpp +++ b/api/direct_bt/GATTCharacteristic.hpp @@ -73,7 +73,7 @@ namespace direct_bt { */ class GATTCharacteristic : public JavaUplink { private: - /* Characteristics's Service back-reference */ + /** Characteristics's service weak back-reference */ std::weak_ptr<GATTService> wbr_service; public: diff --git a/api/direct_bt/GATTDescriptor.hpp b/api/direct_bt/GATTDescriptor.hpp index 5aa75656..97231526 100644 --- a/api/direct_bt/GATTDescriptor.hpp +++ b/api/direct_bt/GATTDescriptor.hpp @@ -61,7 +61,7 @@ namespace direct_bt { */ class GATTDescriptor : public JavaUplink { private: - /* Characteristic Descriptor's Characteristic back-reference */ + /** Descriptor's characteristic weak back-reference */ std::weak_ptr<GATTCharacteristic> wbr_characteristic; public: diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp index 8ad5c78f..3e291f35 100644 --- a/api/direct_bt/GATTHandler.hpp +++ b/api/direct_bt/GATTHandler.hpp @@ -82,7 +82,7 @@ namespace direct_bt { static inline int number(const Defaults d) { return static_cast<int>(d); } private: - /* GATTHandle's Device back-reference */ + /** GATTHandle's device weak back-reference */ std::weak_ptr<DBTDevice> wbr_device; const std::string deviceString; diff --git a/api/direct_bt/GATTService.hpp b/api/direct_bt/GATTService.hpp index fd70e24a..6f0bc71c 100644 --- a/api/direct_bt/GATTService.hpp +++ b/api/direct_bt/GATTService.hpp @@ -63,7 +63,7 @@ namespace direct_bt { */ class GATTService : public JavaUplink { private: - /* Service's Device back-reference */ + /** Service's device weak back-reference */ std::weak_ptr<DBTDevice> wbr_device; public: |