diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-04-13 17:28:46 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-04-13 19:01:26 +0200 |
commit | df556aa47da22f96b3fcd356c12419d3035cba3c (patch) | |
tree | f901a62630cccdd3819b2c28ce3ce2bdc7088b88 /vcl/win | |
parent | 2fd2a7f9b3a866cf4d31f9b496d8f6fd221d75e8 (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
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/app/salinst.cxx | 1 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 26 |
2 files changed, 17 insertions, 10 deletions
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; } |