diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 09:38:12 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 13:01:25 -0400 |
commit | 8b13be7436c522b039fa66732cc9caa3cd9cf225 (patch) | |
tree | 4129567d8afd365999eced85f06ba6d732338f5a /sfx2 | |
parent | 5ed6ba97352bacbf0e423302c52debccbf80114a (diff) |
Use scoped_ptr for this for better exception safety.
Change-Id: I7f14972e562845eb260b3d567c3fbabda2524d41
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 5f39baaa8bcd..340bd94edb52 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -110,6 +110,8 @@ #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/ucb/XContent.hpp> +#include <boost/scoped_ptr.hpp> + #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" using namespace ::com::sun::star; @@ -232,7 +234,8 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert { // slot is a property const SfxType* pType = pSlot->GetType(); - SfxPoolItem* pItem = pType->CreateItem(); + boost::scoped_ptr<SfxPoolItem> pItem(pType->CreateItem()); + if ( !pItem ) { #ifdef DBG_UTIL @@ -338,8 +341,6 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert rSet.Put( *pItem ); } - delete pItem; - return; } @@ -355,7 +356,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ ) { const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs ); - SfxPoolItem* pItem = rArg.CreateItem(); + boost::scoped_ptr<SfxPoolItem> pItem(rArg.CreateItem()); if ( !pItem ) { #ifdef DBG_UTIL @@ -472,8 +473,6 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert } } - - delete pItem; } // special additional parameters for some slots not seen in the slot definitions |