diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 5716da7d4616..85e66a1f27f6 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -492,6 +492,10 @@ Components::Components( { assert(context.is()); lock_ = lock(); + + bool staticize = !!getenv("SAL_CONFIG_STATICIZE"); + Node::setStaticizedFlag(staticize); + OUString conf(expand(u"${CONFIGURATION_LAYERS}"_ustr)); int layer = 0; for (sal_Int32 i = 0;;) { @@ -629,6 +633,8 @@ Components::Components( } i = n; } + + Node::setStaticizedFlag(false); } Components::~Components() diff --git a/configmgr/source/node.cxx b/configmgr/source/node.cxx index fdb166f146b8..3c8387cfaf43 100644 --- a/configmgr/source/node.cxx +++ b/configmgr/source/node.cxx @@ -65,7 +65,18 @@ rtl::Reference< Node > Node::getMember(OUString const & name) { return i == members.end() ? rtl::Reference< Node >() : i->second; } -Node::Node(int layer): layer_(layer), finalized_(Data::NO_LAYER) {} +bool Node::CreateStaticizedNodes = false; + +void Node::setStaticizedFlag(bool staticized) +{ + CreateStaticizedNodes = staticized; +} + +Node::Node(int layer): layer_(layer), finalized_(Data::NO_LAYER) +{ + if (CreateStaticizedNodes) + staticize(); +} Node::Node(const Node & other): SimpleReferenceObject(), layer_(other.layer_), finalized_(other.finalized_) diff --git a/configmgr/source/node.hxx b/configmgr/source/node.hxx index df5a127cdbb5..304307677176 100644 --- a/configmgr/source/node.hxx +++ b/configmgr/source/node.hxx @@ -50,6 +50,9 @@ public: void setLayer(int layer); int getLayer() const { return layer_;} + /// when @staticized is set all new nodes will not ref-count + static void setStaticizedFlag(bool staticized); + void setFinalized(int layer); int getFinalized() const { return finalized_;} @@ -67,6 +70,7 @@ private: int layer_; int finalized_; OUString description_; + static bool CreateStaticizedNodes; }; }