================
@@ -121,8 +135,10 @@ class ValueObjectPrinter {
 private:
   bool ShouldShowName() const;
 
-  ValueObject *m_orig_valobj;
-  ValueObject *m_valobj;
+  ValueObject &m_orig_valobj;
+  ValueObject *m_cached_valobj; /// Cache the current "most specialized" value.
----------------
clayborg wrote:

I wonder if we should start using `std::weak_ptr<ValueObject>` instead of raw 
pointers. Someone is storing a shared pointer to the object somewhere in the 
value object tree, so having a weak pointer could help us to catch these things 
as we can ask `if (m_cached_valobj_wp.expired() == true)` and this would tell 
us that this was assigned to a valid object at one point, but it has been 
freed. The expired call will return false if the weak pointer was never set or 
if the weak pointer was cleared.

https://github.com/llvm/llvm-project/pull/81314
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to