Access safe data members directly

Change-Id: I2305c17d03c4b6ba3f77c7c5952aadda627118ac
This commit is contained in:
Stephan Bergmann
2014-03-18 12:24:49 +01:00
parent c0fb264066
commit 1ae379f6bd
2 changed files with 4 additions and 22 deletions

View File

@@ -24,7 +24,6 @@
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -47,18 +46,12 @@ namespace framework{
It forwards all URL's to the underlying operating system.
So it would e.g. be possible to open HTML files outside the office within a web browser.
@base ThreadHelpBase
exports a lock member to guarantee right initialize value of it
@base OWeakObject
provides XWeak and ref count mechanism
@devstatus ready to use
*/
class SystemExec : // baseclasses
// Order is necessary for right initialization!
private ThreadHelpBase ,
// interfaces
public ::cppu::WeakImplHelper3<
class SystemExec : public ::cppu::WeakImplHelper3<
css::lang::XServiceInfo ,
css::frame::XDispatchProvider ,
css::frame::XNotifyingDispatch > // => XDispatch

View File

@@ -18,7 +18,6 @@
*/
#include <dispatch/systemexec.hxx>
#include <threadhelp/guard.hxx>
#include <general.h>
#include <services.h>
@@ -57,10 +56,7 @@ DEFINE_INIT_SERVICE(SystemExec,
SystemExec::SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
// Init baseclasses first
: ThreadHelpBase( &Application::GetSolarMutex() )
// Init member
, m_xContext ( rxContext )
: m_xContext ( rxContext )
{
}
@@ -68,7 +64,6 @@ SystemExec::SystemExec( const css::uno::Reference< css::uno::XComponentContext >
SystemExec::~SystemExec()
{
m_xContext = NULL;
}
@@ -122,21 +117,15 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL&
}
OUString sSystemURLWithVariables = aURL.Complete.copy(PROTOCOL_LENGTH, c);
// SAFE ->
Guard aReadLock(m_aLock);
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
aReadLock.unlock();
// <- SAFE
// TODO check security settings ...
try
{
css::uno::Reference< css::util::XStringSubstitution > xPathSubst( css::util::PathSubstitution::create(xContext) );
css::uno::Reference< css::util::XStringSubstitution > xPathSubst( css::util::PathSubstitution::create(m_xContext) );
OUString sSystemURL = xPathSubst->substituteVariables(sSystemURLWithVariables, sal_True); // sal_True force an exception if unknown variables exists !
css::uno::Reference< css::system::XSystemShellExecute > xShell = css::system::SystemShellExecute::create( xContext );
css::uno::Reference< css::system::XSystemShellExecute > xShell = css::system::SystemShellExecute::create( m_xContext );
xShell->execute(sSystemURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
impl_notifyResultListener(xListener, css::frame::DispatchResultState::SUCCESS);