Kaydet (Commit) c828e3cc authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#75540 setProcessServiceFactory must be called before InitVCL

...because InitVCL now calls:

> comphelper::getProcessServiceFactory
> comphelper::getProcessComponentContext
> utl::DefaultFontConfiguration::DefaultFontConfiguration
> rtl::Static<utl::DefaultFontConfiguration, (anonymous namespace)::theDefaultFontConfiguration>::get
> utl::DefaultFontConfiguration::get
> ImplStyleData::SetStandardStyles
> ImplStyleData::ImplStyleData
> boost::make_shared<ImplStyleData>
> StyleSettings::StyleSettings
> ImplAllSettingsData::ImplAllSettingsData
> boost::make_shared<ImplAllSettingsData>
> AllSettings::AllSettings
> Application::InitSettings
> Application::GetSettings
> GtkInstance::AfterAppInit
> InitVCL
> ImplSVMain
> SVMain
> sal_main
> main

and Application::Main is only called after InitVCL.

Change-Id: I1126e33f454a4ea35ef295cbd3f48429c473efb4
üst 1712e6c6
...@@ -52,6 +52,11 @@ public: ...@@ -52,6 +52,11 @@ public:
virtual sal_uInt16 Exception( sal_uInt16 nError ); virtual sal_uInt16 Exception( sal_uInt16 nError );
static OUString ReadStringHook( const OUString& ); static OUString ReadStringHook( const OUString& );
private:
virtual void Init() SAL_OVERRIDE;
Reference< XComponentContext > xCtx_;
}; };
void vclmain::createApplication() void vclmain::createApplication()
...@@ -85,35 +90,13 @@ int MyApp::Main() ...@@ -85,35 +90,13 @@ int MyApp::Main()
EnableAutoHelpId(); EnableAutoHelpId();
// create the global service-manager
Reference< XComponentContext > xCtx;
Reference< XMultiServiceFactory > xFactory;
try
{
xCtx = defaultBootstrap_InitialComponentContext();
xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(), UNO_QUERY );
if( xFactory.is() )
setProcessServiceFactory( xFactory );
}
catch( const com::sun::star::uno::Exception& )
{
}
if( ! xFactory.is() )
{
fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
exit( 1 );
}
// Detect desktop environment - need to do this as early as possible // Detect desktop environment - need to do this as early as possible
com::sun::star::uno::setCurrentContext( com::sun::star::uno::setCurrentContext(
new DesktopContext( com::sun::star::uno::getCurrentContext() ) ); new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
// Create UCB (for backwards compatibility, in case some code still uses // Create UCB (for backwards compatibility, in case some code still uses
// plain createInstance w/o args directly to obtain an instance): // plain createInstance w/o args directly to obtain an instance):
com::sun::star::ucb::UniversalContentBroker::create(xCtx); com::sun::star::ucb::UniversalContentBroker::create(xCtx_);
/* /*
* Initialize the MSAA UNO AccessBridge if accessibility is turned on * Initialize the MSAA UNO AccessBridge if accessibility is turned on
...@@ -138,7 +121,7 @@ int MyApp::Main() ...@@ -138,7 +121,7 @@ int MyApp::Main()
*/ */
try try
{ {
Reference<XComponent> xComp(xCtx, UNO_QUERY_THROW); Reference<XComponent> xComp(xCtx_, UNO_QUERY_THROW);
xComp->dispose(); xComp->dispose();
} }
catch(...) catch(...)
...@@ -148,4 +131,27 @@ int MyApp::Main() ...@@ -148,4 +131,27 @@ int MyApp::Main()
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
void MyApp::Init()
{
// create the global service-manager
Reference< XMultiServiceFactory > xFactory;
try
{
xCtx_ = defaultBootstrap_InitialComponentContext();
xFactory = Reference< XMultiServiceFactory >( xCtx_->getServiceManager(), UNO_QUERY );
if( xFactory.is() )
setProcessServiceFactory( xFactory );
}
catch( const com::sun::star::uno::Exception& )
{
}
if( ! xFactory.is() )
{
fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
exit( 1 );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment