diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-06 14:10:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-06 16:12:44 +0200 |
commit | 3035a8066ffc7120bb6a6da2c50d5b032611bb90 (patch) | |
tree | 8fa1c1b77d35f07a63f26ee7e9d4ae952378d6ac /sd | |
parent | 0d24dd25e6f506b5f9128d70d7eb21f0bb4dde89 (diff) |
use rtl::Reference in SvXMLEmbeddedObjectHelper
instead of manual ref-counting
Change-Id: I559ebb3871dd3dd4a160bd83a259e36dd2f7b4d6
Reviewed-on: https://gerrit.libreoffice.org/43200
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/xml/sdxmlwrp.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 405ad7595ce6..00b61eb92859 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -509,7 +509,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) Reference< document::XGraphicObjectResolver > xGraphicResolver; SvXMLGraphicHelper *pGraphicHelper = nullptr; Reference< document::XEmbeddedObjectResolver > xObjectResolver; - SvXMLEmbeddedObjectHelper *pObjectHelper = nullptr; + rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper; Reference< lang::XComponent > xModelComp( mxModel, uno::UNO_QUERY ); @@ -560,10 +560,10 @@ bool SdXMLFilter::Import( ErrCode& nError ) SvXMLGraphicHelperMode::Read, false ); xGraphicResolver = pGraphicHelper; - pObjectHelper = SvXMLEmbeddedObjectHelper::Create( + xObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *pDoc->GetPersist(), SvXMLEmbeddedObjectHelperMode::Read ); - xObjectResolver = pObjectHelper; + xObjectResolver = xObjectHelper.get(); } // Set base URI @@ -652,8 +652,9 @@ bool SdXMLFilter::Import( ErrCode& nError ) if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); xGraphicResolver = nullptr; - if( pObjectHelper ) - SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); + if( xObjectHelper.is() ) + xObjectHelper->dispose(); + xObjectHelper.clear(); xObjectResolver = nullptr; if( mxStatusIndicator.is() ) @@ -783,7 +784,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) bool SdXMLFilter::Export() { - SvXMLEmbeddedObjectHelper* pObjectHelper = nullptr; + rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper; SvXMLGraphicHelper* pGraphicHelper = nullptr; bool bDocRet = false; @@ -874,8 +875,8 @@ bool SdXMLFilter::Export() // create helper for graphic and ole export if we have a storage if( xStorage.is() ) { - pObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *mrDocShell.GetDoc()->GetPersist(), SvXMLEmbeddedObjectHelperMode::Write ); - xObjectResolver = pObjectHelper; + xObjectHelper = SvXMLEmbeddedObjectHelper::Create( xStorage, *mrDocShell.GetDoc()->GetPersist(), SvXMLEmbeddedObjectHelperMode::Write ); + xObjectResolver = xObjectHelper.get(); pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Write, false ); xGrfResolver = pGraphicHelper; @@ -999,8 +1000,9 @@ bool SdXMLFilter::Export() if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); - if( pObjectHelper ) - SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); + if( xObjectHelper ) + xObjectHelper->dispose(); + xObjectHelper.clear(); return bDocRet; } |