sb121: #i110006# do not leak Component singleton (based on a patch by cmc)
This commit is contained in:
parent
086029a4c9
commit
ecbebd83b2
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue