summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-04-13 17:28:46 +0200
committerAndras Timar <andras.timar@collabora.com>2017-04-18 20:15:40 +0200
commit06af76cf2574112aef759f96c0ab2d5de09e94ad (patch)
tree9c1130c127edb4da6812730461b473216000ade8 /vcl
parentff0c559692c263d5eb4243289cdabf79afaff13e (diff)
tdf#106933 vcl: delete D2DWriteTextOutRenderer before exit()
As it happens this DirectWrite stuff is using some thread pool internally, and that must be shutdown before exit(), as Win32 will terminate all other threads at that point, and then the thread pool wants to talk to threads that don't exist any more. https://blogs.msdn.microsoft.com/oldnewthing/20120427-00/?p=7763/ So convert this from a global variable that is deleted from DllMain() to a member of SalData, so it is deleted from DeInitVCL(). Change-Id: I51408a07c78758cf0c193ab66b9214d0c9dbd9e3 (cherry picked from commit df556aa47da22f96b3fcd356c12419d3035cba3c) Reviewed-on: https://gerrit.libreoffice.org/36534 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 1ba5bae490f7e14e475e0b80f03e5f444cdce908)
Diffstat (limited to 'vcl')
-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 fc82e13b617a..cf11a04ddace 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 94ae96d53608..da67ca44582f 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 482cbd7a460c..22a6fb268f55 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3072,20 +3072,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;
}