diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-22 11:12:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-22 12:53:34 +0200 |
commit | 1400274aa4157fd92e708324a46d1633723f00fe (patch) | |
tree | dbe601f33546654e7385b20a92840e6b1d05b821 /vcl | |
parent | a9bba3827888b290c435a3b0e5cdf50846d08bd2 (diff) |
osl::Mutex->std::mutex in GraphicFilter
Change-Id: Ia7d81ad0eaeab4f6ecf89b555da26e42a27bf80b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119361
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 18e8757adfa7..9ffd3601d714 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -20,7 +20,6 @@ #include <config_folders.h> #include <sal/log.hxx> -#include <osl/mutex.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/threadpool.hxx> #include <cppuhelper/implbase.hxx> @@ -80,6 +79,7 @@ #include <unotools/ucbhelper.hxx> #include <vector> #include <memory> +#include <mutex> #include <string_view> #include <vcl/TypeSerializer.hxx> @@ -89,12 +89,11 @@ #include <graphic/GraphicFormatDetector.hxx> #include <graphic/GraphicReader.hxx> -typedef ::std::vector< GraphicFilter* > FilterList_impl; -static FilterList_impl* pFilterHdlList = nullptr; +static std::vector< GraphicFilter* > gaFilterHdlList; -static ::osl::Mutex& getListMutex() +static std::mutex& getListMutex() { - static ::osl::Mutex s_aListProtection; + static std::mutex s_aListProtection; return s_aListProtection; } @@ -327,17 +326,13 @@ GraphicFilter::GraphicFilter( bool bConfig ) GraphicFilter::~GraphicFilter() { { - ::osl::MutexGuard aGuard( getListMutex() ); - auto it = std::find(pFilterHdlList->begin(), pFilterHdlList->end(), this); - if( it != pFilterHdlList->end() ) - pFilterHdlList->erase( it ); + std::lock_guard aGuard( getListMutex() ); + auto it = std::find(gaFilterHdlList.begin(), gaFilterHdlList.end(), this); + if( it != gaFilterHdlList.end() ) + gaFilterHdlList.erase( it ); - if( pFilterHdlList->empty() ) - { - delete pFilterHdlList; - pFilterHdlList = nullptr; + if( gaFilterHdlList.empty() ) delete pConfig; - } } pErrorEx.reset(); @@ -346,17 +341,14 @@ GraphicFilter::~GraphicFilter() void GraphicFilter::ImplInit() { { - ::osl::MutexGuard aGuard( getListMutex() ); + std::lock_guard aGuard( getListMutex() ); - if ( !pFilterHdlList ) - { - pFilterHdlList = new FilterList_impl; + if ( gaFilterHdlList.empty() ) pConfig = new FilterConfigCache( bUseConfig ); - } else - pConfig = pFilterHdlList->front()->pConfig; + pConfig = gaFilterHdlList.front()->pConfig; - pFilterHdlList->push_back( this ); + gaFilterHdlList.push_back( this ); } if( bUseConfig ) |