Boost logo

Boost :

From: Johan Råde (rade_at_[hidden])
Date: 2006-12-11 10:54:18


I have singleton class X.
The instance of X is constructed the first time it is used,
and is destroyed during the static destruction phase at app termination.

X::X() reads data from a ptree
X::~X() writes data to a ptree

My app crashes in X::~X().

The reason is that ptree uses static variables,
for instance in the following function:

   ptree_implementation.h:

   template<class Ptree>
   inline const Ptree &empty_ptree()
   {
     static Ptree pt;
     return pt;
   }

Would it be possible to remove the static variables from the ptree code?
That would make it safe to use ptree during the static destruction phase.

There are several static variables in the ptree code,
and they all seem to be optimizations.
Maybe they are not needed.

--Johan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk