[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - cui/source sfx2/source svtools/source tools/source

Michael Meeks michael.meeks at collabora.com
Fri Dec 15 20:11:31 UTC 2017


 cui/source/factory/cuiresmgr.cxx |    5 +++--
 sfx2/source/bastyp/sfxresid.cxx  |    5 +++--
 svtools/source/misc/svtresid.cxx |    5 +++--
 tools/source/rc/resmgr.cxx       |    4 ----
 4 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit d93718ff92e485ebcd014713574be596b8815ff8
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Dec 15 14:22:10 2017 +0000

    Handle resmgr lifecycle with vcl's de-init more cleanly.
    
    Change-Id: Iee5f54edc09d0df7062ffdcb301876fcec791373
    Reviewed-on: https://gerrit.libreoffice.org/46562
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx
index e61da43b6710..48e942a90685 100644
--- a/cui/source/factory/cuiresmgr.cxx
+++ b/cui/source/factory/cuiresmgr.cxx
@@ -21,15 +21,16 @@
 #include <svl/solar.hrc>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/lazydelete.hxx>
 
 // struct DialogsResMgr --------------------------------------------------
 ResMgr* CuiResMgr::GetResMgr()
 {
-    static std::unique_ptr<ResMgr> pResMgr;
+    static vcl::DeleteOnDeinit<ResMgr> pResMgr(nullptr);
 
     const LanguageTag& rLocale = Application::GetSettings().GetUILanguageTag();
 
-    if (!pResMgr || pResMgr->GetLocale() != rLocale)
+    if (!pResMgr.get() || pResMgr.get()->GetLocale() != rLocale)
     {
         pResMgr.reset(ResMgr::CreateResMgr("cui", rLocale));
     }
diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx
index 40f02c4c3caa..a90d67adee41 100644
--- a/sfx2/source/bastyp/sfxresid.cxx
+++ b/sfx2/source/bastyp/sfxresid.cxx
@@ -21,8 +21,9 @@
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <tools/resmgr.hxx>
+#include <vcl/lazydelete.hxx>
 
-static std::unique_ptr<ResMgr> pMgr;
+static vcl::DeleteOnDeinit<ResMgr> pMgr(nullptr);
 
 SfxResId::SfxResId( sal_uInt16 nId ) :
     ResId( nId, *GetResMgr() )
@@ -33,7 +34,7 @@ ResMgr* SfxResId::GetResMgr()
 {
     const LanguageTag& rLocale = Application::GetSettings().GetUILanguageTag();
 
-    if (!pMgr || pMgr->GetLocale() != rLocale)
+    if (!pMgr.get() || pMgr.get()->GetLocale() != rLocale)
         pMgr.reset(ResMgr::CreateResMgr("sfx", rLocale));
 
     return pMgr.get();
diff --git a/svtools/source/misc/svtresid.cxx b/svtools/source/misc/svtresid.cxx
index e727d95ce461..fa7261f6979e 100644
--- a/svtools/source/misc/svtresid.cxx
+++ b/svtools/source/misc/svtresid.cxx
@@ -21,14 +21,15 @@
 #include <svtools/svtresid.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/lazydelete.hxx>
 
-static std::unique_ptr<ResMgr> pMgr;
+static vcl::DeleteOnDeinit<ResMgr> pMgr(nullptr);
 
 namespace
 {
     ResMgr* getResMgr(const LanguageTag& aLocale)
     {
-        if (!pMgr || pMgr->GetLocale() != aLocale)
+        if (!pMgr.get() || pMgr.get()->GetLocale() != aLocale)
             pMgr.reset(ResMgr::CreateResMgr("svt", aLocale));
 
         return pMgr.get();
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index daea1b5bde64..31c4765f0304 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -838,10 +838,6 @@ ResMgr::ResMgr( InternalResMgr * pImpMgr )
 
 ResMgr::~ResMgr()
 {
-    // our container was freed by DestroyAllResMgr
-    if (!pResMgrMutex)
-        return;
-
     osl::Guard<osl::Mutex> aGuard( getResMgrMutex() );
 
     ResMgrContainer::get().freeResMgr( pImpRes );


More information about the Libreoffice-commits mailing list