From fbc486a449808d1d9261f67ffaa4f0213e80787e Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sat, 11 May 2013 17:52:26 +0100 Subject: fdo#64311 - fix pre-processor conditionals & don't bail-out without gnome-vfs. Change-Id: Ia7a805c95625b52fc99face000587692de21461e --- desktop/Library_sofficeapp.mk | 1 - desktop/source/app/appinit.cxx | 43 +++++++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'desktop') diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 63969960408d..451c1d88233e 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -26,7 +26,6 @@ $(eval $(call gb_Library_use_sdk_api,sofficeapp)) $(eval $(call gb_Library_add_defs,sofficeapp,\ -DDESKTOP_DLLIMPLEMENTATION \ - $(if $(filter TRUE,$(ENABLE_GNOMEVFS)),-DGNOME_VFS_ENABLED) \ $(if $(filter WNT,$(OS)),-DENABLE_QUICKSTART_APPLET) \ $(if $(filter MACOSX,$(OS)),-DENABLE_QUICKSTART_APPLET) \ $(if $(filter TRUE,$(ENABLE_SYSTRAY_GTK)),-DENABLE_QUICKSTART_APPLET) \ diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 05b3b300df1c..de9299b11158 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -20,6 +20,8 @@ #include +#include + #include "app.hxx" #include "cmdlineargs.hxx" #include "desktopresid.hxx" @@ -73,25 +75,32 @@ static void configureUcb() // createInstance w/o args directly to obtain an instance: UniversalContentBroker::create(comphelper::getProcessComponentContext()); -#ifdef GNOME_VFS_ENABLED - // Instantiate GNOME-VFS UCP in the thread that initialized GNOME in order - // to avoid a deadlock that may occure in case the UCP gets initialized from - // a different thread (which may happen when calling remotely via UNO); this - // is not a fix, just a workaround: - Reference< XCurrentContext > xCurrentContext(getCurrentContext()); - Any aValue(xCurrentContext->getValueByName("system.desktop-environment")); - OUString aDesktopEnvironment; - if ((aValue >>= aDesktopEnvironment) && aDesktopEnvironment == "GNOME") +#if ENABLE_GNOME_VFS + try { + // Instantiate GNOME-VFS UCP in the thread that initialized GNOME in order + // to avoid a deadlock that may occure in case the UCP gets initialized from + // a different thread (which may happen when calling remotely via UNO); this + // is not a fix, just a workaround: + Reference< XCurrentContext > xCurrentContext(getCurrentContext()); + Any aValue(xCurrentContext->getValueByName("system.desktop-environment")); + OUString aDesktopEnvironment; + if ((aValue >>= aDesktopEnvironment) && aDesktopEnvironment == "GNOME") + { + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + UniversalContentBroker::create(xContext) + ->registerContentProvider( + Reference( + xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.ucb.GnomeVFSContentProvider", xContext), + UNO_QUERY_THROW), + ".*", false); + } + } + catch ( const uno::Exception & ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - UniversalContentBroker::create(xContext) - ->registerContentProvider( - Reference( - xContext->getServiceManager()->createInstanceWithContext("com.sun.star.ucb.GnomeVFSContentProvider", xContext), - UNO_QUERY_THROW), - ".*", false); + SAL_WARN( "desktop", "missing gnome-vfs component to initialize thread workaround" ); } -#endif // GNOME_VFS_ENABLED +#endif // ENABLE_GNOME_VFS } void Desktop::InitApplicationServiceManager() -- cgit