Re: [Boost-bugs] [Boost C++ Libraries] #10337: weak_ptr & shared_ptr causes double "delete" -> crash

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10337: weak_ptr & shared_ptr causes double "delete" -> crash
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-08-10 16:41:20

#10337: weak_ptr & shared_ptr causes double "delete" -> crash
  Reporter: thesaint1987@… | Owner: pdimov
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: smart_ptr
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:

Comment (by anonymous):

 Yeah I can now tell this issue persists in 1.56...
 Also I found a bug in my code. The issue was that I had two shared_ptr of
 which one was using a weak_ptr to the other. Then the one the weak_ptr
 pointed to got release by C++ before the other, so that the race condition
 above happened. I still think this should be fixed, because its obviously
 a race condition in boost too.

 I solved the issue on my end by simply turning the weak_ptr into a
 shared_ptr and the original shared_ptr that the weak_ptr pointed to into a
 weak_ptr. This will force the correct release order at application exit
 upon boost and prevents the race condition from happening.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC