diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-01-19 19:59:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-20 07:43:42 +0100 |
commit | 08340089c550ce8f2a68ba33bd7c33ac9dee1b1f (patch) | |
tree | cc1d3df270e11ba19734f84f0a7676b7eddb1f7d /vcl | |
parent | 3d3a0c412500a2b57ff1d49f05506ee62ef9d4c7 (diff) |
use unique_ptr for GraphicConverter
Change-Id: If2651d03eb878c499dd5e21df479dcdbcaf93987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/svdata.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 1 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 9 | ||||
-rw-r--r-- | vcl/source/gdi/cvtgrf.cxx | 4 |
5 files changed, 7 insertions, 11 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 564c28bdc9b0..defa97bd5168 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -223,7 +223,7 @@ struct ImplSVGDIData std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache lru_scale_cache maScaleCache = lru_scale_cache(10); // Cache for scaled images ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts - GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics + std::unique_ptr<GraphicConverter> mxGrfConverter; // Converter for graphics tools::Long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width tools::Long mnAppFontY = 0; // AppFont Y-Numenator for 80/tel Height bool mbFontSubChanged = false; // true: FontSubstitution was changed between Begin/End diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 4449f38642ca..69687bd8a6f7 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1521,7 +1521,7 @@ css::uno::Reference< css::awt::XDisplayConnection > Application::GetDisplayConne void Application::SetFilterHdl( const Link<ConvertData&,bool>& rLink ) { - ImplGetSVData()->maGDIData.mpGrfConverter->SetFilterHdl( rLink ); + ImplGetSVData()->maGDIData.mxGrfConverter->SetFilterHdl( rLink ); } const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 29ccf348bc6a..a0a52b91e591 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -27,6 +27,7 @@ #include <configsettings.hxx> #include <vcl/QueueInfo.hxx> +#include <vcl/cvtgrf.hxx> #include <vcl/dockwin.hxx> #include <vcl/menu.hxx> #include <vcl/print.hxx> diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index eaba51522b76..194164946cc6 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -360,7 +360,7 @@ bool InitVCL() // Initialize global data pSVData->maGDIData.mxScreenFontList = std::make_shared<PhysicalFontCollection>(); pSVData->maGDIData.mxScreenFontCache = std::make_shared<ImplFontCache>(); - pSVData->maGDIData.mpGrfConverter = new GraphicConverter; + pSVData->maGDIData.mxGrfConverter.reset(new GraphicConverter); g_bIsLeanException = getenv("LO_LEAN_EXCEPTION") != nullptr; // Set exception handler @@ -466,12 +466,7 @@ void DeInitVCL() pExceptionHandler = nullptr; // free global data - if (pSVData->maGDIData.mpGrfConverter) - { - delete pSVData->maGDIData.mpGrfConverter; - pSVData->maGDIData.mpGrfConverter = nullptr; - } - + pSVData->maGDIData.mxGrfConverter.reset(); pSVData->mpSettingsConfigItem.reset(); // prevent unnecessary painting during Scheduler shutdown diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx index 9e9ecfb6eac2..d14664bd047a 100644 --- a/vcl/source/gdi/cvtgrf.cxx +++ b/vcl/source/gdi/cvtgrf.cxx @@ -33,7 +33,7 @@ GraphicConverter::~GraphicConverter() ErrCode GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat ) { - GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter; + GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mxGrfConverter.get(); ErrCode nRet = ERRCODE_IO_GENERAL; if( pCvt && pCvt->GetFilterHdl().IsSet() ) @@ -54,7 +54,7 @@ ErrCode GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertDat ErrCode GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat ) { - GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter; + GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mxGrfConverter.get(); ErrCode nRet = ERRCODE_IO_GENERAL; if( pCvt && pCvt->GetFilterHdl().IsSet() ) |