================
@@ -1692,6 +1692,20 @@ class Target : public
std::enable_shared_from_this<Target>,
}
};
+/// The private implementation backing SBLock.
+struct APILock {
+ APILock(std::recursive_mutex &mutex) : lock(mutex) {}
+ std::lock_guard<std::recursive_mutex> lock;
+};
+
+/// The private implementation used by SBLock to hand out the target API mutex.
+/// It has a TargetSP to ensure the lock cannot outlive the target.
+struct TargetAPILock : public APILock {
+ TargetAPILock(std::recursive_mutex &mutex, lldb::TargetSP target_sp)
+ : APILock(mutex), target_sp(target_sp) {}
+ lldb::TargetSP target_sp;
----------------
vogelsgesang wrote:
are we lacking a virtual destructor in the base class?
We are holding this class as its base class in
`std::unique_ptr<lldb_private::APILock> m_opaque_up`. Afaict, we hence aren't
calling the destructor of the `target_sp` member?
https://github.com/llvm/llvm-project/pull/131404
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits