[Libreoffice-commits] core.git: vcl/inc vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 21 14:03:38 UTC 2021


 vcl/inc/graphic/Manager.hxx    |    2 +-
 vcl/source/graphic/Manager.cxx |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 300753bf1d4db7eff42d707f427180f0d1d1dffb
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 21 15:00:05 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 21 16:03:01 2021 +0200

    no need to use recursive_mutex in graphic::Manager
    
    regular std::mutex is fine
    
    Change-Id: I820bb83117a0ea920f550f6ad459a623b4939ee3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122390
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index bfd9ef3854f3..60dc62ab184c 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -31,7 +31,7 @@ namespace vcl::graphic
 class Manager final
 {
 private:
-    std::recursive_mutex maMutex; // instead of SolarMutex because graphics can live past vcl main
+    std::mutex maMutex; // instead of SolarMutex because graphics can live past vcl main
     o3tl::sorted_vector<ImpGraphic*> m_pImpGraphicList;
     std::chrono::seconds mnAllowedIdleTime;
     bool mbSwapEnabled;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index b6cb1c0d1fc7..92293dc99db6 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -116,7 +116,7 @@ void Manager::reduceGraphicMemory()
     if (mnUsedSize < mnMemoryLimit)
         return;
 
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
 
     // avoid recursive reduceGraphicMemory on reexport of tdf118346-1.odg to odg
     if (mbReducingGraphicMemory)
@@ -151,7 +151,7 @@ sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
 
 IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
 
     pTimer->Stop();
     reduceGraphicMemory();
@@ -160,7 +160,7 @@ IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
 
 void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
 
     // make some space first
     if (mnUsedSize > mnMemoryLimit)
@@ -191,7 +191,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic)
 
 void Manager::unregisterGraphic(ImpGraphic* pImpGraphic)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
 
     mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
     m_pImpGraphicList.erase(pImpGraphic);
@@ -257,7 +257,7 @@ std::shared_ptr<ImpGraphic> Manager::newInstance(const GraphicExternalLink& rGra
 
 void Manager::swappedIn(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
     if (pImpGraphic)
     {
         mnUsedSize += nSizeBytes;
@@ -266,7 +266,7 @@ void Manager::swappedIn(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
 
 void Manager::swappedOut(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
     if (pImpGraphic)
     {
         mnUsedSize -= nSizeBytes;
@@ -275,7 +275,7 @@ void Manager::swappedOut(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes)
 
 void Manager::changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSizeBytes)
 {
-    std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
+    std::scoped_lock aGuard(maMutex);
 
     mnUsedSize -= nOldSizeBytes;
     mnUsedSize += getGraphicSizeBytes(pImpGraphic);


More information about the Libreoffice-commits mailing list