[Libreoffice-commits] core.git: cui/source

Takeshi Abe tabe at fixedpoint.jp
Tue Jul 29 22:34:38 PDT 2014


 cui/source/dialogs/cuifmsearch.cxx |   11 +++++------
 cui/source/dialogs/pastedlg.cxx    |    4 ++--
 cui/source/dialogs/scriptdlg.cxx   |    3 +--
 cui/source/factory/init.cxx        |    5 ++---
 cui/source/options/optcolor.cxx    |    6 +++---
 cui/source/options/optlingu.cxx    |    8 +++-----
 cui/source/options/optpath.cxx     |    5 ++---
 cui/source/tabpages/autocdlg.cxx   |    7 +++----
 cui/source/tabpages/backgrnd.cxx   |   20 +++++++++-----------
 cui/source/tabpages/chardlg.cxx    |    4 ++--
 cui/source/tabpages/grfpage.cxx    |    4 ++--
 cui/source/tabpages/numpages.cxx   |   16 +++++++---------
 12 files changed, 41 insertions(+), 52 deletions(-)

New commits:
commit c0d298ecec6a615c8f1137c63df5bc484ee9ca33
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Jul 30 14:29:31 2014 +0900

    Avoid possible memory leaks in case of exceptions
    
    Change-Id: I9783669a26fd9c9e2c890f430b29427ccf6bea77

diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 851f2c5..b91be84 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -37,6 +37,7 @@
 #include <comphelper/string.hxx>
 #include <svx/svxdlg.hxx>
 #include <sal/macros.h>
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::i18n;
@@ -326,12 +327,12 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
 {
     if (m_ppbApproxSettings == pButton)
     {
-        AbstractSvxSearchSimilarityDialog* pDlg = NULL;
+        boost::scoped_ptr<AbstractSvxSearchSimilarityDialog> pDlg;
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         if ( pFact )
-            pDlg = pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
-                        m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() );
+            pDlg.reset(pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
+                        m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ));
         DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" );
 
         if ( pDlg && pDlg->Execute() == RET_OK )
@@ -341,7 +342,6 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
             m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
             m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
         }
-        delete pDlg;
     }
     else if (m_pSoundsLikeCJKSettings == pButton)
     {
@@ -349,7 +349,7 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         if(pFact)
         {
-            AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() );
+            boost::scoped_ptr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() ));
             DBG_ASSERT(aDlg, "Dialog creation failed!");
             aDlg->Execute();
 
@@ -361,7 +361,6 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
             OnCheckBoxToggled( m_pcbCase );
             m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() );
             OnCheckBoxToggled( m_pHalfFullFormsCJK );
-            delete aDlg;
         }
     }
 
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 0530383..e1e984d 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -35,6 +35,7 @@
 #include <vcl/settings.hxx>
 
 #include <dialmgr.hxx>
+#include <boost/scoped_ptr.hpp>
 
 SvPasteObjectDialog::SvPasteObjectDialog( Window* pParent )
     : ModalDialog(pParent, "PasteSpecialDialog", "cui/ui/pastespecial.ui")
@@ -175,11 +176,10 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
 
         if( aTypeName.isEmpty() && aSourceName.isEmpty() )
         {
-            ResMgr* pMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() );
+            boost::scoped_ptr<ResMgr> pMgr(ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() ));
             // global resource from svtools (former so3 resource)
             if( pMgr )
                 aSourceName = OUString( ResId( STR_UNKNOWN_SOURCE, *pMgr ) );
-            delete pMgr;
         }
     }
 
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index f40016d..1e43a57 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -70,9 +70,8 @@ using namespace ::com::sun::star::document;
 
 void ShowErrorDialog( const Any& aException )
 {
-    SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException );
+    boost::scoped_ptr<SvxScriptErrorDialog> pDlg(new SvxScriptErrorDialog( NULL, aException ));
     pDlg->Execute();
-    delete pDlg;
 }
 
 SFTreeListBox::SFTreeListBox(Window* pParent)
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index 12d1316..80d25ee 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -19,7 +19,7 @@
 
 #include <vcl/msgbox.hxx>
 #include "cuicharmap.hxx"
-
+#include <boost/scoped_ptr.hpp>
 
 // hook to call special character dialog for edits
 // caution: needs C-Linkage since dynamically loaded via symbol name
@@ -28,7 +28,7 @@ extern "C"
 SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, OUString& o_rResult)
 {
     bool bRet = false;
-    SvxCharacterMap* aDlg = new SvxCharacterMap( i_pParent );
+    boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( i_pParent ));
     aDlg->DisableFontSelection();
     aDlg->SetCharFont(i_rFont);
     if ( aDlg->Execute() == RET_OK )
@@ -36,7 +36,6 @@ SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font&
         o_rResult = aDlg->GetCharacters();
         bRet = true;
     }
-    delete aDlg;
     return bRet;
 }
 }
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 0d939748..e2f853e 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -31,6 +31,7 @@
 #include <unotools/pathoptions.hxx>
 #include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
+#include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 #include <svx/svxdlg.hxx>
 #include <helpid.hrc>
@@ -1157,8 +1158,8 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialog creation failed!");
-        AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton,
-                            sName, CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2) );
+        boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( pButton,
+                            sName, CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2) ));
         DBG_ASSERT(aNameDlg, "Dialog creation failed!");
         aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
         aNameDlg->SetText(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1));
@@ -1173,7 +1174,6 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
             m_pColorSchemeLB->SelectEntry(sName);
             m_pColorSchemeLB->GetSelectHdl().Call(m_pColorSchemeLB);
         }
-        delete aNameDlg;
     }
     else
     {
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 1cd78d9..a5f8f7a 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -68,7 +68,7 @@
 
 #include <vector>
 #include <map>
-
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::ucbhelper;
 using namespace ::rtl;
@@ -1624,7 +1624,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         if(pFact)
         {
-            AbstractSvxNewDictionaryDialog* aDlg = pFact->CreateSvxNewDictionaryDialog( this, xSpellChecker1 );
+            boost::scoped_ptr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog( this, xSpellChecker1 ));
             DBG_ASSERT(aDlg, "Dialog creation failed!");
             uno::Reference< XDictionary >  xNewDic;
             if ( aDlg->Execute() == RET_OK )
@@ -1639,7 +1639,6 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
 
                 AddDicBoxEntry( xNewDic, (sal_uInt16) nLen );
             }
-            delete aDlg;
         }
     }
     else if (m_pLinguDicsEditPB == pBtn)
@@ -1660,10 +1659,9 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
                     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
                     if(pFact)
                     {
-                        VclAbstractDialog* aDlg = pFact->CreateSvxEditDictionaryDialog( this, xDic->getName(), xSpellChecker1, RID_SFXDLG_EDITDICT );
+                        boost::scoped_ptr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName(), xSpellChecker1, RID_SFXDLG_EDITDICT ));
                         DBG_ASSERT(aDlg, "Dialog creation failed!");
                         aDlg->Execute();
-                        delete aDlg;
                     }
                 }
             }
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 2915d1b..d65a9f0 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -551,8 +551,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl)
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         if ( pFact )
         {
-            AbstractSvxMultiPathDialog* pMultiDlg =
-                pFact->CreateSvxMultiPathDialog( this );
+            boost::scoped_ptr<AbstractSvxMultiPathDialog> pMultiDlg(
+                pFact->CreateSvxMultiPathDialog( this ));
             DBG_ASSERT( pMultiDlg, "Dialog creation failed!" );
 
             OUString sPath( sUser );
@@ -599,7 +599,6 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl)
                 pPathImpl->sUserPath = sUser;
                 pPathImpl->sWritablePath = sWritable;
             }
-            delete pMultiDlg;
         }
     }
     else if ( pEntry )
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 57ae3a7..e122603 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -54,6 +54,7 @@
 #include <editeng/unolingu.hxx>
 #include <dialmgr.hxx>
 #include <svx/svxids.hrc>
+#include <boost/scoped_ptr.hpp>
 
 static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM;
 
@@ -693,7 +694,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
     if( nSelEntryPos == REPLACE_BULLETS ||
         nSelEntryPos == APPLY_NUMBERING)
     {
-        SvxCharacterMap *pMapDlg = new SvxCharacterMap(this);
+        boost::scoped_ptr<SvxCharacterMap> pMapDlg(new SvxCharacterMap(this));
         ImpUserData* pUserData = (ImpUserData*)m_pCheckLB->FirstSelected()->GetUserData();
         pMapDlg->SetCharFont(*pUserData->pFont);
         pMapDlg->SetChar( (*pUserData->pString)[0] );
@@ -706,7 +707,6 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
             OUString aOUStr( &aChar, 1 );
             *pUserData->pString = aOUStr;
         }
-        delete pMapDlg;
     }
     else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
     {
@@ -1973,7 +1973,7 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
     else if (pBtn == m_pDblEndQuotePB)
         nMode = DBL_END;
     // start character selection dialog
-    SvxCharacterMap* pMap = new SvxCharacterMap( this, true );
+    boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
     pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT,
                         LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 ));
     pMap->SetText(nMode < SGL_END ? m_sStartQuoteDlg  : m_sEndQuoteDlg );
@@ -2033,7 +2033,6 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
             break;
         }
     }
-    delete pMap;
 
     return 0;
 }
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index a478dfc..6c65cfc 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -55,6 +55,7 @@
 #include <svl/intitem.hxx>
 #include <sfx2/request.hxx>
 #include <svtools/grfmgr.hxx>
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star;
 // static ----------------------------------------------------------------
@@ -657,13 +658,13 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
     const SvxBrushItem* pBgdAttr = NULL;
     sal_uInt16 nSlot = SID_VIEW_FLD_PIC;
     sal_uInt16 nWhich = GetWhich( nSlot );
-    SvxBrushItem* pTemp = 0;
+    boost::scoped_ptr<SvxBrushItem> pTemp;
 
     if ( rSet.GetItemState( nWhich, false ) >= SFX_ITEM_AVAILABLE )
     {
         const CntWallpaperItem* pItem = (const CntWallpaperItem*)&rSet.Get( nWhich );
-        pTemp = new SvxBrushItem( *pItem, nWhich );
-        pBgdAttr = pTemp;
+        pTemp.reset(new SvxBrushItem( *pItem, nWhich ));
+        pBgdAttr = pTemp.get();
     }
 
     m_pBtnTile->Check();
@@ -694,8 +695,6 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
     bLinkOnly = true;
     m_pBtnLink->Check( true );
     m_pBtnLink->Show( false );
-
-    delete pTemp;
 }
 
 
@@ -850,13 +849,13 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
             }
             else
             {
-                SvxBrushItem* pTmpBrush = 0;
+                boost::scoped_ptr<SvxBrushItem> pTmpBrush;
                 if ( m_pBtnLink->IsChecked() )
                 {
-                    pTmpBrush = new SvxBrushItem( aBgdGraphicPath,
+                    pTmpBrush.reset(new SvxBrushItem( aBgdGraphicPath,
                                                 aBgdGraphicFilter,
                                                 GetGraphicPosition_Impl(),
-                                                nWhich );
+                                                nWhich ));
                 }
                 else
                 {
@@ -864,15 +863,14 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
                         bIsGraphicValid = LoadLinkedGraphic_Impl();
 
                     if ( bIsGraphicValid )
-                        pTmpBrush = new SvxBrushItem( aBgdGraphic,
+                        pTmpBrush.reset(new SvxBrushItem( aBgdGraphic,
                                                     GetGraphicPosition_Impl(),
-                                                    nWhich );
+                                                    nWhich ));
                 }
                 if(pTmpBrush)
                 {
                     lcl_SetTransparency(*pTmpBrush, static_cast<long>(m_pGraphTransMF->GetValue()));
                     rCoreSet->Put(*pTmpBrush);
-                    delete pTmpBrush;
                 }
             }
             bModified = ( bIsBrush || m_pBtnLink->IsChecked() || bIsGraphicValid );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 98a0e17..71e22ee 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -70,6 +70,7 @@
 #include <svl/intitem.hxx>
 #include <sfx2/request.hxx>
 #include "svx/flagsdef.hxx"
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star;
 
@@ -3372,7 +3373,7 @@ void SvxCharTwoLinesPage::Initialize()
 void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
 {
     bool bStart = pBox == m_pStartBracketLB;
-    SvxCharacterMap* aDlg = new SvxCharacterMap( this );
+    boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( this ));
     aDlg->DisableFontSelection();
 
     if ( aDlg->Execute() == RET_OK )
@@ -3384,7 +3385,6 @@ void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
     {
         pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition );
     }
-    delete aDlg;
 }
 
 
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index f0db0ef..c0bf573 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -34,6 +34,7 @@
 #include <svx/dialogs.hrc>
 #include <vcl/builder.hxx>
 #include <vcl/settings.hxx>
+#include <boost/scoped_ptr.hpp>
 
 #define CM_1_TO_TWIP        567
 #define TWIP_TO_INCH        1440
@@ -280,14 +281,13 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
     {
         sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_CROP );
         FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW ));
-        SvxGrfCrop* pNew = (SvxGrfCrop*)rSet->Get( nW ).Clone();
+        boost::scoped_ptr<SvxGrfCrop> pNew((SvxGrfCrop*)rSet->Get( nW ).Clone());
 
         pNew->SetLeft( lcl_GetValue( *m_pLeftMF, eUnit ) );
         pNew->SetRight( lcl_GetValue( *m_pRightMF, eUnit ) );
         pNew->SetTop( lcl_GetValue( *m_pTopMF, eUnit ) );
         pNew->SetBottom( lcl_GetValue( *m_pBottomMF, eUnit ) );
         bModified |= 0 != rSet->Put( *pNew );
-        delete pNew;
     }
 
     if( m_pZoomConstRB->IsValueChangedFromSaved() )
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 70644d8..ede42d2 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -71,6 +71,7 @@
 #include <svl/aeitem.hxx>
 #include <svl/stritem.hxx>
 #include <svl/slstitm.hxx>
+#include <boost/scoped_ptr.hpp>
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -2006,7 +2007,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
 
 IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
 {
-    SvxCharacterMap* pMap = new SvxCharacterMap( this, true );
+    boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
 
     sal_uInt16 nMask = 1;
     const Font* pFmtFont = 0;
@@ -2061,7 +2062,6 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
 
         SetModified();
     }
-    delete pMap;
     return 0;
 }
 
@@ -2291,7 +2291,7 @@ void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
     const Color aBackColor = rStyleSettings.GetFieldColor();
     const Color aTextColor = rStyleSettings.GetFieldTextColor();
 
-    VirtualDevice* pVDev = new VirtualDevice(*this);
+    boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this));
     pVDev->EnableRTL( IsRTLEnabled() );
     pVDev->SetMapMode(GetMapMode());
     pVDev->SetOutputSize( aSize );
@@ -2388,14 +2388,14 @@ void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
                 sal_uInt16 nBulletWidth = 0;
                 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
                 {
-                    nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt,
+                    nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt,
                                         nNumberXPos,
                                             nYStart, nWidthRelation) : 0;
                 }
                 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
                 {
                     nBulletWidth =  rFmt.IsShowSymbol() ?
-                     lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
+                        lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
                 }
                 else
                 {
@@ -2513,7 +2513,7 @@ void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
                 {
                     if(rFmt.IsShowSymbol())
                     {
-                        nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
+                        nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYStart, nWidthRelation);
                         nTextOffset = nTextOffset + nXStep;
                     }
                 }
@@ -2521,7 +2521,7 @@ void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
                 {
                     if(rFmt.IsShowSymbol())
                     {
-                        nTextOffset =  lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
+                        nTextOffset =  lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetSize());
                         nTextOffset = nTextOffset + nXStep;
                     }
                 }
@@ -2575,8 +2575,6 @@ void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
     DrawOutDev( Point(0,0), aSize,
                 Point(0,0), aSize,
                         *pVDev );
-    delete pVDev;
-
 }
 
 //See uiconfig/swriter/ui/outlinepositionpage.ui for effectively a duplicate


More information about the Libreoffice-commits mailing list