summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/win/saldata.hxx4
-rw-r--r--vcl/win/app/salinst.cxx1
-rw-r--r--vcl/win/gdi/winlayout.cxx26
3 files changed, 21 insertions, 10 deletions
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index 2fb1b49d5177..0e13cef9970a 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -39,6 +39,7 @@ class WinSalPrinter;
namespace vcl { class Font; }
struct HDCCache;
struct TempFontItem;
+class TextOutRenderer;
#define MAX_STOCKPEN 4
#define MAX_STOCKBRUSH 4
@@ -118,6 +119,9 @@ public:
std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle()
std::map< UINT,sal_uInt16 > maVKMap; // map some dynamic VK_* entries
+
+ // must be deleted before exit(), so delete it in DeInitSalData()
+ std::unique_ptr<TextOutRenderer> m_pTextOutRenderer;
};
inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; }
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index d0a8d01e5cca..c5cab1fd2d82 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -39,6 +39,7 @@
#include "win/salobj.h"
#include "win/saltimer.h"
#include "win/salbmp.h"
+#include "win/winlayout.hxx"
#include "salimestatus.hxx"
#include "salsys.hxx"
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 3f12664b8d96..7c593371790a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -245,20 +245,26 @@ void D2DWriteTextOutRenderer::CleanupModules()
TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
{
- if (bUseDWrite)
- {
- static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules()
- ? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer())
- : static_cast<TextOutRenderer*>(new ExTextOutRenderer));
+ SalData *const pSalData = GetSalData();
- return *_impl;
+ if (!pSalData)
+ { // don't call this after DeInitVCL()
+ fprintf(stderr, "TextOutRenderer fatal error: no SalData");
+ abort();
}
- else
- {
- static std::unique_ptr<TextOutRenderer> _impl(new ExTextOutRenderer);
- return *_impl;
+ if (!pSalData->m_pTextOutRenderer)
+ {
+ if (bUseDWrite && D2DWriteTextOutRenderer::InitModules())
+ {
+ pSalData->m_pTextOutRenderer.reset(new D2DWriteTextOutRenderer());
+ }
+ else
+ {
+ pSalData->m_pTextOutRenderer.reset(new ExTextOutRenderer());
+ }
}
+ return *pSalData->m_pTextOutRenderer;
}