summaryrefslogtreecommitdiff
path: root/desktop/source/deployment
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-10-30 17:11:59 +0100
committerAndras Timar <atimar@suse.com>2013-01-13 22:00:42 +0100
commit645fc0ce677a4da7f175419b950b12e2eae76f84 (patch)
tree3445578722fbe0b2cc325f2ba83311d0fc63b2fa /desktop/source/deployment
parent1ee11a24aa30b498c0c2d741bee2085de55e69b6 (diff)
Resolves: fdo#51638 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. (cherry picked from commit 37cc83e594fa8ca131fc5fb98506287b7daedffd) Conflicts: desktop/source/pkgchk/unopkg/unopkg_app.cxx desktop/source/pkgchk/unopkg/unopkg_shared.h Change-Id: Ibec3d19040fdae23f492cd1e29084e673403e00b Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop/source/deployment')
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx16
-rw-r--r--desktop/source/deployment/inc/dp_misc.h8
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx25
3 files changed, 49 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..cec91ad4730e 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>
@@ -47,6 +48,8 @@
#include "license_dialog.hxx"
#include "dp_gui_dialog2.hxx"
#include "dp_gui_extensioncmdqueue.hxx"
+#include <ucbhelper/contentbroker.hxx>
+
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -66,6 +69,7 @@ public:
// Application
virtual int Main();
+ virtual void DeInit();
};
//______________________________________________________________________________
@@ -85,6 +89,18 @@ int MyApp::Main()
}
+void MyApp::DeInit()
+{
+ if (::ucbhelper::ContentBroker::get())
+ ::ucbhelper::ContentBroker::deinitialize();
+ 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
{
struct ProductName
diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h
index 06e67aa1cde8..b95a64cc27ed 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 9ed579fbb97c..00fd352ac1ab 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -43,6 +43,7 @@
#include "osl/mutex.hxx"
#include "com/sun/star/ucb/CommandAbortedException.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/bridge/XBridgeFactory.hpp"
#include "com/sun/star/bridge/UnoUrlResolver.hpp"
#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
#include "com/sun/star/deployment/ExtensionManager.hpp"
@@ -631,7 +632,31 @@ void syncRepositories(
}
}
+void disposeBridges(Reference<css::uno::XComponentContext> const & ctx)
+{
+ if (!ctx.is())
+ return;
+ Reference<css::bridge::XBridgeFactory> bridgeFac(
+ ctx->getServiceManager()->createInstanceWithContext(
+ OUSTR("com.sun.star.bridge.BridgeFactory"), ctx),
+ UNO_QUERY_THROW);
+
+ 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& )
+ {
+ }
+ }
+ }
+}
}