summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-09-08 11:18:15 +0200
committerDavid Tardon <dtardon@redhat.com>2016-09-09 07:30:30 +0200
commit3ef084c9bd7a7952a0e69efb9dbda81473c7856b (patch)
tree8c50c000f7cb29c28152c95ef7d0391ad122a38f
parent4f776e0ff2d7b3635dc504c3251dddd03f76c205 (diff)
remove direct memory management
Change-Id: Id0278f15e0c46a32cf07900dffdf27b3acb2649c
-rw-r--r--include/xmloff/shapeimport.hxx3
-rw-r--r--xmloff/source/draw/ximp3dscene.cxx17
2 files changed, 5 insertions, 15 deletions
diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
index e9bc24f7eea7..3042e03537fc 100644
--- a/include/xmloff/shapeimport.hxx
+++ b/include/xmloff/shapeimport.hxx
@@ -204,7 +204,7 @@ protected:
SvXMLImport& mrImport;
// list for local light contexts
- ::std::vector< SdXML3DLightContext* >
+ ::std::vector< css::uno::Reference< SdXML3DLightContext > >
maList;
// local parameters which need to be read
@@ -228,7 +228,6 @@ protected:
public:
SdXML3DSceneAttributesHelper( SvXMLImport& rImporter );
- ~SdXML3DSceneAttributesHelper();
/** creates a 3d light context and adds it to the internal list for later processing */
SvXMLImportContext * create3DLightContext( sal_uInt16 nPrfx, const OUString& rLName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
index 7680acf0bfbb..31ce368758df 100644
--- a/xmloff/source/draw/ximp3dscene.cxx
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -226,24 +226,15 @@ SdXML3DSceneAttributesHelper::SdXML3DSceneAttributesHelper( SvXMLImport& rImport
{
}
-SdXML3DSceneAttributesHelper::~SdXML3DSceneAttributesHelper()
-{
- // release remembered light contexts, they are no longer needed
- for ( size_t i = maList.size(); i > 0; )
- maList[ --i ]->ReleaseRef();
- maList.clear();
-}
-
/** creates a 3d light context and adds it to the internal list for later processing */
SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uInt16 nPrfx, const OUString& rLName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList)
{
- SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList);
+ const uno::Reference<SdXML3DLightContext> xContext{new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList)};
// remember SdXML3DLightContext for later evaluation
- pContext->AddFirstRef();
- maList.push_back( static_cast<SdXML3DLightContext*>(pContext) );
+ maList.push_back(xContext);
- return pContext;
+ return xContext.get();
}
/** this should be called for each scene attribute */
@@ -376,7 +367,7 @@ void SdXML3DSceneAttributesHelper::setSceneAttributes( const css::uno::Reference
// set lights
for( size_t a = 0; a < maList.size(); a++)
{
- SdXML3DLightContext* pCtx = maList[ a ];
+ SdXML3DLightContext* pCtx = maList[ a ].get();
// set anys
aAny <<= pCtx->GetDiffuseColor();