diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-06-12 17:20:32 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-06-13 17:42:58 +0200 |
commit | da8bfce2574b0aec269004154965f44aa101a15b (patch) | |
tree | 877285b1a23eb3e6bb6f6d41d7b22721199e5c85 /framework | |
parent | 85e6eb78c76263bd10644212b161c6c433e8096d (diff) |
Fix memory leak
Change-Id: Ib0a2d8d69f5bd43872c949d79c685f71657dc9db
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/inc/loadenv/loadenv.hxx | 6 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 13 |
2 files changed, 8 insertions, 11 deletions
diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 355f23b6d0c6..55d9a9337189 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/URL.hpp> - +#include <rtl/ref.hxx> #include <unotools/mediadescriptor.hxx> #include <comphelper/sequenceashashmap.hxx> #include <cppuhelper/implbase2.hxx> @@ -192,7 +192,7 @@ private: */ ActionLockGuard m_aTargetLock; - QuietInteraction* m_pQuietInteraction; + rtl::Reference<QuietInteraction> m_pQuietInteraction; public: @@ -367,7 +367,7 @@ public: const css::uno::Reference< css::uno::XComponentContext >& i_rxContext, utl::MediaDescriptor& io_lMediaDescriptor, const bool _bUIMode, - QuietInteraction** o_ppQuiteInteraction + rtl::Reference<QuietInteraction>* o_ppQuiteInteraction ); /** TODO document me ... */ diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 2c02d4dc64cf..a87e61839f8d 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -132,7 +132,6 @@ LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xCont , m_bCloseFrameOnError(false) , m_bReactivateControllerOnError(false) , m_bLoaded( false ) - , m_pQuietInteraction( 0 ) { } @@ -297,7 +296,7 @@ void LoadEnv::initializeLoading(const OUString& void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XComponentContext >& i_rxContext, utl::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, - QuietInteraction** o_ppQuietInteraction ) + rtl::Reference<QuietInteraction>* o_ppQuietInteraction ) { css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; sal_Int16 nMacroMode; @@ -319,12 +318,11 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XCompon { nMacroMode = css::document::MacroExecMode::NEVER_EXECUTE; nUpdateMode = css::document::UpdateDocMode::NO_UPDATE; - QuietInteraction* pQuietInteraction = new QuietInteraction(); - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(pQuietInteraction), css::uno::UNO_QUERY); + rtl::Reference<QuietInteraction> pQuietInteraction = new QuietInteraction(); + xInteractionHandler = pQuietInteraction.get(); if ( o_ppQuietInteraction != NULL ) { *o_ppQuietInteraction = pQuietInteraction; - (*o_ppQuietInteraction)->acquire(); } } @@ -1618,11 +1616,10 @@ void LoadEnv::impl_reactForLoadingState() css::uno::Any aRequest; bool bThrow = false; - if ( !m_bLoaded && m_pQuietInteraction && m_pQuietInteraction->wasUsed() ) + if ( !m_bLoaded && m_pQuietInteraction.is() && m_pQuietInteraction->wasUsed() ) { aRequest = m_pQuietInteraction->getRequest(); - m_pQuietInteraction->release(); - m_pQuietInteraction = 0; + m_pQuietInteraction.clear(); bThrow = true; } |