summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-03-11 13:31:37 +0100
committersb <sb@openoffice.org>2010-03-11 13:31:37 +0100
commitecbebd83b28891e6a57791a62f8049f8cfe30f47 (patch)
treed9c66e0273afdffaae47fb75d74f80d9ff42d9a3 /configmgr
parent086029a4c92cc1233a7daf91647e4fe927f27bcb (diff)
sb121: #i110006# do not leak Component singleton (based on a patch by cmc)
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/components.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 51a1a6547d9b..51cc76bef602 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -112,7 +112,7 @@ rtl::OUString expand(rtl::OUString const & str) {
}
static bool singletonCreated = false;
-static Components * singleton; // leaks
+static Components * singleton = 0;
}
@@ -122,7 +122,8 @@ void Components::initSingleton(
OSL_ASSERT(context.is());
if (!singletonCreated) {
singletonCreated = true;
- singleton = new Components(context);
+ static Components theSingleton(context);
+ singleton = &theSingleton;
}
}