diff options
author | Duncan Foster <dfoster@openoffice.org> | 2003-05-21 08:04:36 +0000 |
---|---|---|
committer | Duncan Foster <dfoster@openoffice.org> | 2003-05-21 08:04:36 +0000 |
commit | aaea78d06351ddc95d897723d4a3d3de76dd4b72 (patch) | |
tree | 684eaf56061a026ffbd47701d44123f14a43d046 /scripting/source/runtimemgr | |
parent | 961796ddcff53dab4c3e8d4db8c352f561e6d2a2 (diff) |
#i14018# Fixed disposing of filesys storages
Diffstat (limited to 'scripting/source/runtimemgr')
-rw-r--r-- | scripting/source/runtimemgr/ScriptNameResolverImpl.cxx | 28 | ||||
-rwxr-xr-x | scripting/source/runtimemgr/ScriptRuntimeManager.cxx | 11 |
2 files changed, 29 insertions, 10 deletions
diff --git a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx index b7901d9f8ff7..ee7e5c7eb305 100644 --- a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx +++ b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptNameResolverImpl.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: dfoster $ $Date: 2003-05-16 10:14:21 $ + * last change: $Author: dfoster $ $Date: 2003-05-21 09:04:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,6 +154,8 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE Any any; OUString docUri; + sal_Int32 filesysScriptStorageID; + Reference < storage::XScriptStorageManager > xScriptStorageMgr; sal_Int32 docSid; try { @@ -261,13 +263,11 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE ::rtl::OUStringToOString( filesysURL, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); // ask storage manager to create storage - sal_Int32 filesysScriptStorageID; try { // need to get the ScriptStorageManager Any a = m_xContext->getValueByName( scriptingConstantsPool.SCRIPTSTORAGEMANAGER_SERVICE ); - Reference < storage::XScriptStorageManager > xScriptStorageMgr; if ( sal_False == ( a >>= xScriptStorageMgr ) ) { OUString temp = OUSTR( "ScriptNameResolverImpl::resolve: failed to get ScriptStorageManager" ); @@ -391,6 +391,26 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE } if ( !resolvedName.is() ) { + if( filesysScriptStorageID > 2 ) + { + // get the filesys storage and dispose of it + Reference< XInterface > xScriptStorage = + xScriptStorageMgr->getScriptStorage( filesysScriptStorageID ); + validateXRef( xScriptStorage, + "ScriptNameResolverImpl::getStorageInstance: cannot get Script Storage service" ); + Reference< storage::XScriptInfoAccess > xScriptInfoAccess = Reference< + storage::XScriptInfoAccess > ( xScriptStorage, UNO_QUERY_THROW ); + validateXRef( xScriptInfoAccess, + "ScriptNameResolverImpl::resolveURIFromStorageID: cannot get XScriptInfoAccess" ); + Sequence< Reference< storage::XScriptInfo > > results = + xScriptInfoAccess->getAllImplementations( ); + Reference < lang::XEventListener > xEL_ScriptStorageMgr = + Reference< lang::XEventListener > + ( xScriptStorageMgr ,UNO_QUERY_THROW ); + validateXRef( xEL_ScriptStorageMgr, "ScriptNameResolverImpl::resolve: can't get ScriptStorageManager XEventListener interface when trying to dispose of filesystem storage" ); + lang::EventObject event( results[ 0 ] ); + xEL_ScriptStorageMgr->disposing( event ); + } throw lang::IllegalArgumentException( OUSTR( "ScriptNameResolverImpl::resolve: no script found for uri=" ).concat( scriptURI ), Reference< XInterface > (), 0 ); diff --git a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx index 2a31a1688732..7a9609275afb 100755 --- a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx +++ b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptRuntimeManager.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: dfoster $ $Date: 2003-05-16 10:14:21 $ + * last change: $Author: dfoster $ $Date: 2003-05-21 09:04:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XEventListener.hpp> - +#include <com/sun/star/lang/EventObject.hpp> #include "ScriptNameResolverImpl.hxx" #include "ScriptRuntimeManager.hxx" @@ -284,9 +284,8 @@ Any SAL_CALL ScriptRuntimeManager::invoke( Reference< XInterface > () ); } validateXRef( xEL_ScriptStorageManager, "Cannot get XEventListener from ScriptStorageManager" ); - // need to find some way of wrapping this resolvedSid - // into an EventObject object - // xEL_ScriptStorageManager->disposing( source ); + lang::EventObject event(resolvedScript); + xEL_ScriptStorageManager->disposing( event ); } } catch ( lang::IllegalArgumentException & iae ) |