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

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 30 10:42:13 PDT 2020


We should probably outlaw the shared pointer from weak pointer constructor in lldb.  It looks like the only safe way to use it is in a try/catch block (or by preflighting the weak pointer with lock which renders it pretty much pointless.)

Jim


> On Sep 30, 2020, at 6:02 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> labath added a comment.
> 
> In D88266#2302245 <https://reviews.llvm.org/D88266#2302245>, @jingham wrote:
> 
>> Use std::weak_ptr::lock to make the shared pointer, rather than std::shared_ptr::shared_ptr(std::weak_ptr) (sort of), as the latter throws.
> 
> Yep, `wp.lock()` behaves differently from the shared_ptr constructor. :)
> 
> 
> 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