summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-07-26 23:42:36 +0200
committerMichael Stahl <mstahl@redhat.com>2016-07-29 10:05:47 +0000
commita2095b151409f0fb57aa8feaa4c6282f84040245 (patch)
tree08d70dc7853bb2eafa69bf3cb8c9eceb7df2e5fd /vcl
parentResolves: tdf#96677 effects page didn't link labels to what they labelled (diff)
downloadcore-a2095b151409f0fb57aa8feaa4c6282f84040245.tar.gz
core-a2095b151409f0fb57aa8feaa4c6282f84040245.zip
comphelper,vcl: let DeInitVCL() join some AsyncEventNotifier threads
comphelper::AsyncEventNotifier is an amazing class that dispatches events in separate threads, no doubt implemented during times of exuberant optimism about the tractability of shared-state multi-threading. Unfortunately the authors forgot to think about how all those awesome threads will be joined, so if they are somehow blocked, then it may well happen that the events are dispatched when the main thread is already in DeInitVCL, and the objects required for the dispatching already smell somewhat funny. This happens quite reproducibly when changing dbaccess' ModelMethodGuard to lock the SolarMutex too, then CppunitTest_dbaccess_RowSetClones crashes in DeInitVCL() because one AsyncEventNotifier thread was blocked until then by SolarMutexGuard, and this test never Yields once its document is loaded. Try to fix this by joining the "DocumentEventNotifier" threads from DeInitVCL() itself. Since there's no rtl::WeakReference to go with rtl::Reference, refactor the AsyncEventNotifier and create a new AsyncEventNotifierAutoJoin that has to be used with std::shared_ptr and std::weak_ptr. Change-Id: I50a0749795acb04b0776e543f7125767b697ea35 Reviewed-on: https://gerrit.libreoffice.org/27581 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svmain.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index b3f4ed688d1e..aba97b58482a 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -28,6 +28,7 @@
#include <tools/resmgr.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/asyncnotification.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <vcl/svapp.hxx>
@@ -352,6 +353,10 @@ VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */)
void DeInitVCL()
{
+ {
+ SolarMutexReleaser r; // unblock threads blocked on that so we can join
+ ::comphelper::JoinAsyncEventNotifiers();
+ }
ImplSVData* pSVData = ImplGetSVData();
// lp#1560328: clear cache before disposing rest of VCL
if(pSVData->mpBlendFrameCache)