diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-12 09:36:09 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-12 11:43:50 +0000 |
commit | 9a46b626c5e8bfbc478fe765aaaee61d1e56d037 (patch) | |
tree | 6dac69ad41ccfaa2e1fcce153d2d5de0a2a9e326 /svx | |
parent | 4be58b0b9d2817be716a0271320c70064d2b3d88 (diff) |
fix SvxShowCharSetItem leak
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/charmap.hxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/charmap.cxx | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/svx/inc/svx/charmap.hxx b/svx/inc/svx/charmap.hxx index 7e863915e52b..f5bb08b26eee 100644 --- a/svx/inc/svx/charmap.hxx +++ b/svx/inc/svx/charmap.hxx @@ -33,6 +33,7 @@ #include <vcl/ctrl.hxx> #include <vcl/metric.hxx> #include <vcl/scrbar.hxx> +#include <boost/shared_ptr.hpp> #include <map> #include <tools/shl.hxx> #include "svx/svxdllapi.h" @@ -106,7 +107,7 @@ protected: private: - typedef ::std::map<sal_Int32, ::svx::SvxShowCharSetItem*> ItemsMap; + typedef ::std::map<sal_Int32, boost::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap; ItemsMap m_aItems; Link aDoubleClkHdl; Link aSelectHdl; diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index e3a40b2c1b9e..8a1974bf543f 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -677,7 +677,9 @@ void SvxShowCharSet::ReleaseAccessible() if ( aFind == m_aItems.end() ) { OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?"); - aFind = m_aItems.insert(ItemsMap::value_type(_nPos,new ::svx::SvxShowCharSetItem(*this,m_pAccessible->getTable(),sal::static_int_cast< sal_uInt16 >(_nPos)))).first; + boost::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this, + m_pAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos))); + aFind = m_aItems.insert(ItemsMap::value_type(_nPos, xItem)).first; rtl::OUStringBuffer buf; buf.appendUtf32( maFontCharMap.GetCharFromIndex( _nPos ) ); aFind->second->maText = buf.makeStringAndClear(); @@ -685,7 +687,7 @@ void SvxShowCharSet::ReleaseAccessible() aFind->second->maRect = Rectangle( Point( pix.X() + 1, pix.Y() + 1 ), Size(nX-1,nY-1) ); } - return aFind->second; + return aFind->second.get(); } // ----------------------------------------------------------------------------- |