diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-09-22 11:20:01 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-09-22 20:42:23 +0200 |
commit | ca8a4c81a4194cfaa526bd8071a2243aad0f3461 (patch) | |
tree | cb22c6d1bbdfa9dff376d85a612ad9ab49db200b /vcl/unx | |
parent | 893c08b59abf31ee0ae50c4ac030b006c43c0976 (diff) |
vcl: [loplugin:badstatics] pManager
Move this to class GenericUnixSalData, which is deleted on shutdown.
Change-Id: I6366c12f255bfeca737b22259c3f58ffa2c6222c
Reviewed-on: https://gerrit.libreoffice.org/42632
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 6726deeefb90..c7ff4c1f5e45 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -30,6 +30,7 @@ #include "impfontcharmap.hxx" #include "svdata.hxx" #include "unx/geninst.h" +#include "unx/gendata.hxx" #include <vcl/strhelper.hxx> #include <vcl/ppdparser.hxx> #include <vcl/embeddedfontshelper.hxx> @@ -111,19 +112,30 @@ PrintFontManager::PrintFont::PrintFont() { } +GenericUnixSalData::GenericUnixSalData(GenericUnixSalDataType const t, SalInstance *const pInstance) + : m_eType(t), m_pDisplay(nullptr), m_pPrintFontManager(nullptr) +{ + m_pInstance = pInstance; SetSalData(this); +} + +GenericUnixSalData::~GenericUnixSalData() +{ +} + /* * one instance only */ PrintFontManager& PrintFontManager::get() { - static PrintFontManager* pManager = nullptr; - if( ! pManager ) + GenericUnixSalData *const pSalData(GetGenericUnixSalData()); + assert(pSalData); + + if (!pSalData->m_pPrintFontManager) { - static PrintFontManager theManager; - pManager = &theManager; - pManager->initialize(); + pSalData->m_pPrintFontManager.reset( new PrintFontManager ); + pSalData->m_pPrintFontManager->initialize(); } - return *pManager; + return *pSalData->m_pPrintFontManager; } /* |