clayborg added inline comments.

================
Comment at: lldb/include/lldb/Core/StructuredDataImpl.h:72-74
+    lldb::StructuredDataPluginSP plugin_sp;
+    if (!m_plugin_wp.expired())
+      plugin_sp = lldb::StructuredDataPluginSP(m_plugin_wp);
----------------
jingham wrote:
> labath wrote:
> > This is racy. The right way to do that is to call `m_plugin_wp.lock()` and 
> > then check the validity of the returned shared_ptr.
> I tried that, but at least on the version of the STL on the latest macOS if 
> the weak pointer has just been default initialized if you call lock on it it 
> crashes.  expired was the only call I could make that didn't crash.
> I tried that, but at least on the version of the STL on the latest macOS if 
> the weak pointer has just been default initialized if you call lock on it it 
> crashes.  expired was the only call I could make that didn't crash.

that seems like a pretty serious bug?! This should be fixed or any use of 
std::weak_ptr would crash?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88266/new/

https://reviews.llvm.org/D88266

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to