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:


   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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at