Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5226: weak_ptr in program segfaults after expiring from shared_ptr from dynamically loaded shared library which was destructed and unloaded
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-02-24 15:34:54
#5226: weak_ptr in program segfaults after expiring from shared_ptr from
dynamically loaded shared library which was destructed and unloaded
-----------------------------------------------------+----------------------
Reporter: Peter Schüller <schueller.p@â¦> | Owner: pdimov
Type: Bugs | Status: new
Milestone: To Be Determined | Component: smart_ptr
Version: Boost Release Branch | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------+----------------------
Comment (by pdimov):
This is expected, sorry. Creating the shared_ptr in the shared library
instantiates a vtable, which is accessed when the last weak_ptr is
destroyed. One workaround is to expose a C interface from the shared
library:
T * create();
void destroy( T* );
and create the shared_ptr in an inline wrapper on the program side:
shared_ptr<T>( create(), destroy ).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5226#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC