From ca8a4c81a4194cfaa526bd8071a2243aad0f3461 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 22 Sep 2017 11:20:01 +0200 Subject: 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 Reviewed-by: Michael Stahl --- vcl/unx/generic/fontmanager/fontmanager.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'vcl/unx') 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 #include #include @@ -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; } /* -- cgit