[Libreoffice-commits] core.git: 2 commits - basic/source sd/inc sd/source
Stephan Bergmann
sbergman at redhat.com
Thu Feb 5 03:47:57 PST 2015
basic/source/runtime/runtime.cxx | 8 ++++----
sd/inc/sdmod.hxx | 7 ++++---
sd/source/ui/unoidl/unoobj.cxx | 26 ++++++++++++--------------
3 files changed, 20 insertions(+), 21 deletions(-)
New commits:
commit 7078f667a3e39601c6d135e311de67fbab289a2b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Feb 5 12:40:29 2015 +0100
Don't hold refcounted objects by naked pointer
(and no need to hold css::uno::Sequence objects by pointer either). Regression
from e537d227d3a801076aff98c113650942fb6b3699 "hard to find accidental leaks
with all the deliberate ones" caused JunitTest_svx_unoapi to sometimes crash.
Change-Id: I3579c4bbac58d7e341c8acb52dd3f0f06f7b2245
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index d2a64ac..d3ae1b2 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -23,6 +23,7 @@
#include "glob.hxx"
#include "pres.hxx"
+#include <rtl/ref.hxx>
#include <sot/storage.hxx>
#include <tools/shl.hxx>
#include "sddllapi.h"
@@ -32,7 +33,7 @@
#include <sfx2/module.hxx>
#include <vcl/vclevent.hxx>
#include <sal/types.h>
-#include <boost/ptr_container/ptr_map.hpp>
+#include <map>
#include <memory>
class SdOptions;
@@ -60,8 +61,8 @@ enum SdOptionStreamMode
SD_OPTION_STORE = 1
};
-typedef boost::ptr_map< sal_uIntPtr, SfxExtItemPropertySetInfo > SdExtPropertySetInfoCache;
-typedef boost::ptr_map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
+typedef std::map< sal_uIntPtr, rtl::Reference<SfxExtItemPropertySetInfo> > SdExtPropertySetInfoCache;
+typedef std::map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
/*
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 47fe407..59aeaa2 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -19,7 +19,7 @@
#include <sal/config.h>
-#include <map>
+#include <utility>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/presentation/ClickAction.hpp>
@@ -338,24 +338,24 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
else
{
sal_uInt32 nObjId = mpShape->getShapeKind();
- uno::Sequence< uno::Type >* pTypes;
+ uno::Sequence< uno::Type > aTypes;
SdTypesCache& gImplTypesCache = SD_MOD()->gImplTypesCache;
SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
if( aIter == gImplTypesCache.end() )
{
- pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
- sal_uInt32 nCount = pTypes->getLength();
- pTypes->realloc( nCount+1 );
- (*pTypes)[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
+ aTypes = mpShape->_getTypes();
+ sal_uInt32 nCount = aTypes.getLength();
+ aTypes.realloc( nCount+1 );
+ aTypes[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
- gImplTypesCache.insert(nObjId, pTypes);
+ gImplTypesCache.insert(std::make_pair(nObjId, aTypes));
}
else
{
// use the already computed implementation id
- pTypes = (*aIter).second;
+ aTypes = (*aIter).second;
}
- return *pTypes;
+ return aTypes;
}
}
@@ -422,7 +422,7 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
throw(::com::sun::star::uno::RuntimeException)
{
sal_uIntPtr nObjId = reinterpret_cast<sal_uIntPtr>(mpShape->getPropertyMapEntries());
- SfxExtItemPropertySetInfo* pInfo = NULL;
+ rtl::Reference<SfxExtItemPropertySetInfo> pInfo;
SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ?
SD_MOD()->gImplImpressPropertySetInfoCache : SD_MOD()->gImplDrawPropertySetInfoCache;
@@ -432,9 +432,8 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
{
uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
- pInfo->acquire();
- rCache.insert(nObjId, pInfo);
+ rCache.insert(std::make_pair(nObjId, pInfo));
}
else
{
@@ -442,8 +441,7 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
pInfo = (*aIter).second;
}
- uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
- return pInfo;
+ return pInfo.get();
}
void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
commit 0f86834bd5e2f8d8c7c7880c6f97273d45c599de
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Feb 5 12:39:16 2015 +0100
Remove redundant explicit up-casts
Change-Id: I58fd91354fe41673216674f5ae9c11c17cb3f29d
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index e87a109..4dc9979 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1713,7 +1713,7 @@ void SbiRuntime::StepPUT()
// store on its own method (inside a function)?
bool bFlagsChanged = false;
SbxFlagBits n = SBX_NONE;
- if( refVar.get() == static_cast<SbxVariable*>(pMeth) )
+ if( refVar.get() == pMeth )
{
bFlagsChanged = true;
n = refVar->GetFlags();
@@ -1865,7 +1865,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
bool bFlagsChanged = false;
SbxFlagBits n = SBX_NONE;
- if( refVar.get() == static_cast<SbxVariable*>(pMeth) )
+ if( refVar.get() == pMeth )
{
bFlagsChanged = true;
n = refVar->GetFlags();
@@ -2066,7 +2066,7 @@ void SbiRuntime::StepLSET()
else
{
SbxFlagBits n = refVar->GetFlags();
- if( refVar.get() == static_cast<SbxVariable*>(pMeth) )
+ if( refVar.get() == pMeth )
{
refVar->SetFlag( SBX_WRITE );
}
@@ -2102,7 +2102,7 @@ void SbiRuntime::StepRSET()
else
{
SbxFlagBits n = refVar->GetFlags();
- if( refVar.get() == static_cast<SbxVariable*>(pMeth) )
+ if( refVar.get() == pMeth )
{
refVar->SetFlag( SBX_WRITE );
}
More information about the Libreoffice-commits
mailing list