diff options
-rw-r--r-- | desktop/Library_sofficeapp.mk | 2 | ||||
-rw-r--r-- | desktop/source/app/appinit.cxx | 42 |
2 files changed, 25 insertions, 19 deletions
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 4a6fccf940ab..8aa9d54345e3 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -38,7 +38,7 @@ $(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 TRUE,$(ENABLE_GNOMEVFS)),-DENABLE_GNOME_VFS) \ $(if $(filter WNT,$(GUI)),-DENABLE_QUICKSTART_APPLET) \ $(if $(filter aqua,$(GUIBASE)),-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 7012243704fc..92ab2bc3d2ed 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -80,26 +80,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") +#ifdef 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<XContentProvider>( + xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.ucb.GnomeVFSContentProvider", xContext), + UNO_QUERY_THROW), + ".*", false); + } + } + catch ( const Exception & ) { - UniversalContentBroker::create( - comphelper::getProcessComponentContext())-> - registerContentProvider( - Reference<XContentProvider>( - comphelper::getProcessServiceFactory()->createInstance( - "com.sun.star.ucb.GnomeVFSContentProvider"), - UNO_QUERY_THROW), - ".*", false); + OSL_FAIL( "missing gnome-vfs component to initialize thread workaround" ); } -#endif // GNOME_VFS_ENABLED +#endif // ENABLE_GNOME_VFS } void Desktop::InitApplicationServiceManager() |