[Lldb-commits] [PATCH] D88266: Check that the "StructuredData Plugin weak pointer" is good before trying to turn it into a shared pointer

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 29 04:59:48 PDT 2020


labath 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);
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88266



More information about the lldb-commits mailing list