summaryrefslogtreecommitdiff
path: root/desktop/source/deployment
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-10-30 17:11:59 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-10-30 17:16:31 +0100
commit37cc83e594fa8ca131fc5fb98506287b7daedffd (patch)
tree6bab3ad21edbbccdaf5d324689f8e7b5f8b94f01 /desktop/source/deployment
parent25db3f9d3605fd1ab5b8dee86d2d13b6cb80c9b1 (diff)
In "unopkg gui" dispose component context from DeInitVCL
...the same way it is done in soffice.bin. framework's Desktop::dispose() requires the solar mutex to be still alive, which is destroyed in DeInitVCL, so if the component context/service manager is only disposed afterwards, the solar mutex is already gone. This required moving disposeBridges() around, but it allowed to get rid of DisposeGuard. Change-Id: Ibec3d19040fdae23f492cd1e29084e673403e00b
Diffstat (limited to 'desktop/source/deployment')
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx11
-rw-r--r--desktop/source/deployment/inc/dp_misc.h8
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx22
3 files changed, 41 insertions, 0 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 71c6ccd74ff4..7c83aabac00e 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -33,6 +33,7 @@
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/implementationentry.hxx"
#include "unotools/configmgr.hxx"
+#include "comphelper/processfactory.hxx"
#include "comphelper/servicedecl.hxx"
#include "comphelper/unwrapargs.hxx"
#include <i18npool/mslangid.hxx>
@@ -66,6 +67,7 @@ public:
// Application
virtual int Main();
+ virtual void DeInit();
};
//______________________________________________________________________________
@@ -84,6 +86,15 @@ int MyApp::Main()
return EXIT_SUCCESS;
}
+void MyApp::DeInit()
+{
+ css::uno::Reference< css::uno::XComponentContext > context(
+ comphelper::getProcessComponentContext());
+ dp_misc::disposeBridges(context);
+ css::uno::Reference< css::lang::XComponent >(
+ context, css::uno::UNO_QUERY_THROW)->dispose();
+ comphelper::setProcessServiceFactory(0);
+}
namespace
{
diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h
index 248b81f69805..cf17cb529578 100644
--- a/desktop/source/deployment/inc/dp_misc.h
+++ b/desktop/source/deployment/inc/dp_misc.h
@@ -159,6 +159,14 @@ void syncRepositories(
::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv);
+/** workaround: for some reason the bridge threads which communicate with the
+ uno.exe process are not released on time
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void disposeBridges(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & ctx);
+
}
#endif
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 31cb38c2f4ed..55d372431ef9 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -41,6 +41,7 @@
#include "osl/mutex.hxx"
#include "com/sun/star/ucb/CommandAbortedException.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/bridge/BridgeFactory.hpp"
#include "com/sun/star/bridge/UnoUrlResolver.hpp"
#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
#include "com/sun/star/deployment/ExtensionManager.hpp"
@@ -586,7 +587,28 @@ void syncRepositories(
}
}
+void disposeBridges(Reference<css::uno::XComponentContext> const & ctx)
+{
+ if (!ctx.is())
+ return;
+ Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(ctx) );
+
+ const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
+ for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
+ {
+ Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
+ if (comp.is())
+ {
+ try {
+ comp->dispose();
+ }
+ catch ( const css::lang::DisposedException& )
+ {
+ }
+ }
+ }
+}
}