Subject: [Boost-bugs] [Boost C++ Libraries] #9553: destruction of flyweights fails from a module which never creates flyweigths
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-01-08 11:31:58
#9553: destruction of flyweights fails from a module which never creates
flyweigths
------------------------------------+-------------------------
Reporter: Axel Habermann <haa@â¦> | Owner: joaquin
Type: Bugs | Status: new
Milestone: To Be Determined | Component: flyweight
Version: Boost 1.55.0 | Severity: Showstopper
Keywords: |
------------------------------------+-------------------------
Using a factory pattern together with shared_ptr, all flyweight instances
are created in one dll only.
Due to shared ownership, they might be destroyed from a dll which never
creates a single flyweight.
Because erase does not call core::init(), the module global state for
flyweight management is never initialized, even when using
intermodule_holder, leading to a crash when accessed.
It is not possible
to provide a minimal example, because the example must consist of
different modules.
The following patch fixes the problem:
{{{
Index: flyweight/detail/flyweight_core.hpp
===================================================================
--- flyweight/detail/flyweight_core.hpp (revision 462875)
+++ flyweight/detail/flyweight_core.hpp (revision 462876)
@@ -65,6 +65,7 @@
template<typename Checker>
static void erase(const handle_type& h,Checker chk)
{
+ core::init();
typedef typename core::lock_type lock_type;
lock_type lock(core::mutex());
if(chk(h))core::factory().erase(h);
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9553> 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:15 UTC