[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - chart2/source sw/source
Michael Meeks
michael.meeks at collabora.com
Tue May 22 16:03:57 UTC 2018
chart2/source/tools/ResourceManager.cxx | 7 ++++---
sw/source/uibase/app/swmodule.cxx | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)
New commits:
commit eac3d5cb7ec2369bd5409e79ce4b96552651dbaf
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue May 22 15:52:50 2018 +0100
Use vcl::DeleteOnDeinit for resource managers.
Change-Id: I305c2dfd407f2606331a5950a3b36ee58e1d74d6
Reviewed-on: https://gerrit.libreoffice.org/54676
Reviewed-by: Aron Budea <aron.budea at collabora.com>
Tested-by: Aron Budea <aron.budea at collabora.com>
diff --git a/chart2/source/tools/ResourceManager.cxx b/chart2/source/tools/ResourceManager.cxx
index ee842e701d48..77ed2232df95 100644
--- a/chart2/source/tools/ResourceManager.cxx
+++ b/chart2/source/tools/ResourceManager.cxx
@@ -20,6 +20,7 @@
#include "ResourceManager.hxx"
#include <vcl/svapp.hxx>
+#include <vcl/lazydelete.hxx>
#include <tools/resmgr.hxx>
namespace chart
@@ -28,11 +29,11 @@ namespace chart
ResMgr & ResourceManager::getResourceManager()
{
// not threadsafe
- static std::unique_ptr<ResMgr> pResourceManager;
+ static vcl::DeleteOnDeinit<ResMgr> pResourceManager(nullptr);
const LanguageTag& rLocale = Application::GetSettings().GetUILanguageTag();
- if( ! pResourceManager || pResourceManager->GetLocale() != rLocale )
+ if( ! pResourceManager.get() || pResourceManager.get()->GetLocale() != rLocale )
pResourceManager.reset( ResMgr::CreateResMgr("chartcontroller", rLocale) );
- OSL_ASSERT( pResourceManager );
+ OSL_ASSERT( pResourceManager.get() );
return *pResourceManager.get();
}
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 2edfc5bd25ed..ff703050bf85 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -128,7 +128,7 @@
bool g_bNoInterrupt = false;
#include <sfx2/app.hxx>
-
+#include <vcl/lazydelete.hxx>
#include <svx/svxerr.hxx>
#include <unomid.h>
@@ -140,11 +140,11 @@ using namespace com::sun::star;
ResMgr & GetSwResMgr()
{
// not threadsafe
- static std::unique_ptr<ResMgr> pResourceManager;
+ static vcl::DeleteOnDeinit<ResMgr> pResourceManager(nullptr);
const LanguageTag& rLocale = Application::GetSettings().GetUILanguageTag();
- if( ! pResourceManager || pResourceManager->GetLocale() != rLocale )
+ if( ! pResourceManager.get() || pResourceManager.get()->GetLocale() != rLocale )
pResourceManager.reset( ResMgr::CreateResMgr("sw", rLocale) );
- OSL_ASSERT( pResourceManager );
+ OSL_ASSERT( pResourceManager.get() );
return *pResourceManager.get();
}
More information about the Libreoffice-commits
mailing list