[Libreoffice-commits] core.git: Branch 'feature/vclref' - canvas/source compilerplugins/clang filter/source sc/source sw/inc sw/source vcl/source vcl/workben

Noel Grandin noel at peralex.com
Fri Mar 20 05:28:35 PDT 2015


 canvas/source/vcl/backbuffer.hxx               |    2 
 compilerplugins/clang/vclwidgets.cxx           |    2 
 filter/source/graphicfilter/epict/epict.cxx    |   12 ++---
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx        |    5 --
 sc/source/ui/dbgui/csvruler.cxx                |   54 ++++++++++++-------------
 sc/source/ui/inc/autofmt.hxx                   |    2 
 sc/source/ui/miscdlgs/autofmt.cxx              |   34 +++++++--------
 sc/source/ui/sidebar/CellLineStyleValueSet.cxx |    2 
 sw/inc/hints.hxx                               |    3 -
 sw/source/core/attr/hints.cxx                  |    2 
 sw/source/core/draw/dflyobj.cxx                |    2 
 sw/source/core/layout/paintfrm.cxx             |    4 -
 sw/source/core/layout/virtoutp.cxx             |    3 -
 sw/source/core/layout/virtoutp.hxx             |    2 
 sw/source/core/text/itratr.cxx                 |    4 -
 vcl/source/filter/wmf/emfwr.hxx                |    4 -
 vcl/workben/vcldemo.cxx                        |    3 -
 17 files changed, 69 insertions(+), 71 deletions(-)

New commits:
commit 245ad2a07941b9795859044e13f31d7a6821de05
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Mar 20 14:27:53 2015 +0200

    wrap more stuff in VclPtr
    
    Change-Id: Ia742c47399231bc5914b6586132ad3daf694fdb0

diff --git a/canvas/source/vcl/backbuffer.hxx b/canvas/source/vcl/backbuffer.hxx
index 479f4dd..0beeda2 100644
--- a/canvas/source/vcl/backbuffer.hxx
+++ b/canvas/source/vcl/backbuffer.hxx
@@ -43,7 +43,7 @@ namespace vclcanvas
          */
         BackBuffer( const OutputDevice& rRefDevice,
                     bool                bMonochromeBuffer=false );
-        ~BackBuffer();
+        virtual ~BackBuffer();
 
         virtual OutputDevice&       getOutDev() SAL_OVERRIDE;
         virtual const OutputDevice& getOutDev() const SAL_OVERRIDE;
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index ffa73a8..092770d 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -243,6 +243,8 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
         && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, class OTableWindow *>")
         && !startsWith(pVarDecl->getType().getAsString(), "::dbp::OMultiInstanceAutoRegistration< ::dbp::OUnoAutoPilot<")
         && !startsWith(pVarDecl->getType().getAsString(), "SwSidebarWin_iterator")
+        && !startsWith(pVarDecl->getType().getAsString(), "functor_vector_type")
+        && !startsWith(pVarDecl->getType().getAsString(), "const functor_vector_type")
         && containsWindowSubclass(pVarDecl->getType()))
     {
         report(
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 55ac6ea..30ea2ff 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1858,24 +1858,24 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
 
             case META_GRADIENT_ACTION:
             {
-                VirtualDevice               aVDev;
+                ScopedVclPtr<VirtualDevice> aVDev;
                 GDIMetaFile                 aTmpMtf;
                 const MetaGradientAction*   pA = static_cast<const MetaGradientAction*>(pMA);
 
-                aVDev.SetMapMode( aTargetMapMode );
-                aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+                aVDev->SetMapMode( aTargetMapMode );
+                aVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
                 WriteOpcodes( aTmpMtf );
             }
             break;
 
             case META_HATCH_ACTION:
             {
-                VirtualDevice           aVDev;
+                ScopedVclPtr<VirtualDevice> aVDev;
                 GDIMetaFile             aTmpMtf;
                 const MetaHatchAction*  pA = static_cast<const MetaHatchAction*>(pMA);
 
-                aVDev.SetMapMode( aTargetMapMode );
-                aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+                aVDev->SetMapMode( aTargetMapMode );
+                aVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
                 WriteOpcodes( aTmpMtf );
             }
             break;
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 3b525ed..d0e181b 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -401,7 +401,7 @@ void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ )
     Size aSliderWindowSize = GetOutputSizePixel();
     Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
 
-    VirtualDevice* pVDev = new VirtualDevice( *this );
+    ScopedVclPtr<VirtualDevice> pVDev = new VirtualDevice( *this );
     pVDev->SetOutputSizePixel( aSliderWindowSize );
 
     Rectangle   aSlider = aRect;
@@ -484,9 +484,6 @@ void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ )
     pVDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton );
 
     DrawOutDev( Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev );
-
-    delete pVDev;
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx
index 5d80d36..5ea8a42 100644
--- a/sc/source/ui/dbgui/csvruler.cxx
+++ b/sc/source/ui/dbgui/csvruler.cxx
@@ -93,8 +93,8 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
     EnableRTL( false ); // RTL
     InitColors();
     InitSizeData();
-    maBackgrDev.SetFont( GetFont() );
-    maRulerDev.SetFont( GetFont() );
+    maBackgrDev->SetFont( GetFont() );
+    maRulerDev->SetFont( GetFont() );
 
     load_FixedWidthList( maSplits );
 }
@@ -165,8 +165,8 @@ void ScCsvRuler::InitSizeData()
     maActiveRect.SetPos( Point( GetFirstX(), (GetHeight() - nActiveHeight - 1) / 2 ) );
     maActiveRect.SetSize( Size( nActiveWidth, nActiveHeight ) );
 
-    maBackgrDev.SetOutputSizePixel( maWinSize );
-    maRulerDev.SetOutputSizePixel( maWinSize );
+    maBackgrDev->SetOutputSizePixel( maWinSize );
+    maRulerDev->SetOutputSizePixel( maWinSize );
 
     InvalidateGfx();
 }
@@ -533,30 +533,30 @@ void ScCsvRuler::ImplRedraw()
             ImplDrawBackgrDev();
             ImplDrawRulerDev();
         }
-        DrawOutDev( Point(), maWinSize, Point(), maWinSize, maRulerDev );
+        DrawOutDev( Point(), maWinSize, Point(), maWinSize, *maRulerDev.get() );
         ImplDrawTrackingRect();
     }
 }
 
 void ScCsvRuler::ImplDrawArea( sal_Int32 nPosX, sal_Int32 nWidth )
 {
-    maBackgrDev.SetLineColor();
+    maBackgrDev->SetLineColor();
     Rectangle aRect( Point( nPosX, 0 ), Size( nWidth, GetHeight() ) );
-    maBackgrDev.SetFillColor( maBackColor );
-    maBackgrDev.DrawRect( aRect );
+    maBackgrDev->SetFillColor( maBackColor );
+    maBackgrDev->DrawRect( aRect );
 
     aRect = maActiveRect;
     aRect.Left() = std::max( GetFirstX(), nPosX );
     aRect.Right() = std::min( std::min( GetX( GetPosCount() ), GetLastX() ), nPosX + nWidth - sal_Int32( 1 ) );
     if( aRect.Left() <= aRect.Right() )
     {
-        maBackgrDev.SetFillColor( maActiveColor );
-        maBackgrDev.DrawRect( aRect );
+        maBackgrDev->SetFillColor( maActiveColor );
+        maBackgrDev->DrawRect( aRect );
     }
 
-    maBackgrDev.SetLineColor( maTextColor );
+    maBackgrDev->SetLineColor( maTextColor );
     sal_Int32 nY = GetHeight() - 1;
-    maBackgrDev.DrawLine( Point( nPosX, nY ), Point( nPosX + nWidth - 1, nY ) );
+    maBackgrDev->DrawLine( Point( nPosX, nY ), Point( nPosX + nWidth - 1, nY ) );
 }
 
 void ScCsvRuler::ImplDrawBackgrDev()
@@ -564,8 +564,8 @@ void ScCsvRuler::ImplDrawBackgrDev()
     ImplDrawArea( 0, GetWidth() );
 
     // scale
-    maBackgrDev.SetLineColor( maTextColor );
-    maBackgrDev.SetFillColor();
+    maBackgrDev->SetLineColor( maTextColor );
+    maBackgrDev->SetFillColor();
     sal_Int32 nPos;
 
     sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - (sal_Int32)(1L), (sal_Int32)(0L) );
@@ -575,21 +575,21 @@ void ScCsvRuler::ImplDrawBackgrDev()
     {
         sal_Int32 nX = GetX( nPos );
         if( nPos % 5 )
-            maBackgrDev.DrawPixel( Point( nX, nY ) );
+            maBackgrDev->DrawPixel( Point( nX, nY ) );
         else
-            maBackgrDev.DrawLine( Point( nX, nY - 1 ), Point( nX, nY + 1 ) );
+            maBackgrDev->DrawLine( Point( nX, nY - 1 ), Point( nX, nY + 1 ) );
     }
 
     // texts
-    maBackgrDev.SetTextColor( maTextColor );
-    maBackgrDev.SetTextFillColor();
+    maBackgrDev->SetTextColor( maTextColor );
+    maBackgrDev->SetTextFillColor();
     for( nPos = ((nFirstPos + 9) / 10) * 10; nPos <= nLastPos; nPos += 10 )
     {
         OUString aText( OUString::number( nPos ) );
-        sal_Int32 nTextWidth = maBackgrDev.GetTextWidth( aText );
+        sal_Int32 nTextWidth = maBackgrDev->GetTextWidth( aText );
         sal_Int32 nTextX = GetX( nPos ) - nTextWidth / 2;
         ImplDrawArea( nTextX - 1, nTextWidth + 2 );
-        maBackgrDev.DrawText( Point( nTextX, maActiveRect.Top() ), aText );
+        maBackgrDev->DrawText( Point( nTextX, maActiveRect.Top() ), aText );
     }
 }
 
@@ -599,10 +599,10 @@ void ScCsvRuler::ImplDrawSplit( sal_Int32 nPos )
     {
         Point aPos( GetX( nPos ) - mnSplitSize / 2, GetHeight() - mnSplitSize - 2 );
         Size aSize( mnSplitSize, mnSplitSize );
-        maRulerDev.SetLineColor( maTextColor );
-        maRulerDev.SetFillColor( maSplitColor );
-        maRulerDev.DrawEllipse( Rectangle( aPos, aSize ) );
-        maRulerDev.DrawPixel( Point( GetX( nPos ), GetHeight() - 2 ) );
+        maRulerDev->SetLineColor( maTextColor );
+        maRulerDev->SetFillColor( maSplitColor );
+        maRulerDev->DrawEllipse( Rectangle( aPos, aSize ) );
+        maRulerDev->DrawPixel( Point( GetX( nPos ), GetHeight() - 2 ) );
     }
 }
 
@@ -613,14 +613,14 @@ void ScCsvRuler::ImplEraseSplit( sal_Int32 nPos )
         ImplInvertCursor( GetRulerCursorPos() );
         Point aPos( GetX( nPos ) - mnSplitSize / 2, 0 );
         Size aSize( mnSplitSize, GetHeight() );
-        maRulerDev.DrawOutDev( aPos, aSize, aPos, aSize, maBackgrDev );
+        maRulerDev->DrawOutDev( aPos, aSize, aPos, aSize, *maBackgrDev.get() );
         ImplInvertCursor( GetRulerCursorPos() );
     }
 }
 
 void ScCsvRuler::ImplDrawRulerDev()
 {
-    maRulerDev.DrawOutDev( Point(), maWinSize, Point(), maWinSize, maBackgrDev );
+    maRulerDev->DrawOutDev( Point(), maWinSize, Point(), maWinSize, *maBackgrDev.get() );
     ImplInvertCursor( GetRulerCursorPos() );
 
     sal_uInt32 nFirst = maSplits.LowerBound( GetFirstVisPos() );
@@ -634,7 +634,7 @@ void ScCsvRuler::ImplInvertCursor( sal_Int32 nPos )
 {
     if( IsVisibleSplitPos( nPos ) )
     {
-        ImplInvertRect( maRulerDev, Rectangle( Point( GetX( nPos ) - 1, 0 ), Size( 3, GetHeight() - 1 ) ) );
+        ImplInvertRect( *maRulerDev.get(), Rectangle( Point( GetX( nPos ) - 1, 0 ), Size( 3, GetHeight() - 1 ) ) );
         if( HasSplit( nPos ) )
             ImplDrawSplit( nPos );
     }
diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx
index 070ef9f..3cd9bc3 100644
--- a/sc/source/ui/inc/autofmt.hxx
+++ b/sc/source/ui/inc/autofmt.hxx
@@ -56,7 +56,7 @@ protected:
 
 private:
     ScAutoFormatData*       pCurData;
-    VirtualDevice           aVD;
+    ScopedVclPtr<VirtualDevice> aVD;
     SvtScriptedTextHelper   aScriptedText;
     ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter;
     bool                    bFitWidth;
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 81f69cc..96bdbc5 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -57,8 +57,8 @@
 ScAutoFmtPreview::ScAutoFmtPreview(vcl::Window* pParent)
     : Window(pParent)
     , pCurData(NULL)
-    , aVD(*this)
-    , aScriptedText(aVD)
+    , aVD(new VirtualDevice(*this))
+    , aScriptedText(*aVD.get())
     , bFitWidth(false)
     , mbRTL(false)
     , aStrJan(ScResId(STR_JAN))
@@ -382,11 +382,11 @@ void ScAutoFmtPreview::DrawBackground()
                 const SvxBrushItem* pItem = static_cast< const SvxBrushItem* >(
                     pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND ) );
 
-                aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
-                aVD.SetLineColor();
-                aVD.SetFillColor( pItem->GetColor() );
-                aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) );
-                aVD.Pop();
+                aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+                aVD->SetLineColor();
+                aVD->SetFillColor( pItem->GetColor() );
+                aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) );
+                aVD->Pop();
             }
         }
     }
@@ -405,7 +405,7 @@ void ScAutoFmtPreview::PaintCells()
 
         // 3) border
         if ( pCurData->GetIncludeFrame() )
-            maArray.DrawArray( aVD );
+            maArray.DrawArray( *aVD.get() );
     }
 }
 
@@ -490,20 +490,20 @@ void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData )
 
 void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ )
 {
-    sal_uInt32 nOldDrawMode = aVD.GetDrawMode();
+    sal_uInt32 nOldDrawMode = aVD->GetDrawMode();
 
     Size aWndSize( GetSizePixel() );
-    vcl::Font aFont( aVD.GetFont() );
+    vcl::Font aFont( aVD->GetFont() );
     Color aBackCol( GetSettings().GetStyleSettings().GetWindowColor() );
     Point aTmpPoint;
     Rectangle aRect( aTmpPoint, aWndSize );
 
     aFont.SetTransparent( true );
-    aVD.SetFont( aFont );
-    aVD.SetLineColor();
-    aVD.SetFillColor( aBackCol );
-    aVD.SetOutputSize( aWndSize );
-    aVD.DrawRect( aRect );
+    aVD->SetFont( aFont );
+    aVD->SetLineColor();
+    aVD->SetFillColor( aBackCol );
+    aVD->SetOutputSize( aWndSize );
+    aVD->DrawRect( aRect );
 
     PaintCells();
     SetLineColor();
@@ -513,9 +513,9 @@ void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ )
     Point aPos( (aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2 );
     if (Application::GetSettings().GetLayoutRTL())
        aPos.X() = -aPos.X();
-    DrawOutDev( aPos, aWndSize, Point(), aWndSize, aVD );
+    DrawOutDev( aPos, aWndSize, Point(), aWndSize, *aVD.get() );
 
-    aVD.SetDrawMode( nOldDrawMode );
+    aVD->SetDrawMode( nOldDrawMode );
 }
 
 void ScAutoFmtPreview::Paint( const Rectangle& rRect )
diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
index cdc0e0c..7ad4b71 100644
--- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
@@ -39,7 +39,7 @@ CellLineStyleValueSet::~CellLineStyleValueSet()
 
 void CellLineStyleValueSet::dispose()
 {
-    delete pVDev;
+    pVDev.disposeAndClear();
     ValueSet::dispose();
 }
 
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index c34a95b..92a5744 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_INC_HINTS_HXX
 
 #include <swatrset.hxx>
+#include <vcl/vclptr.hxx>
 #include <vector>
 
 class SwFmt;
@@ -138,7 +139,7 @@ public:
         To get the page/chapter number, the frame has to be asked. For that we need
         the current OutputDevice.
     */
-    SwRefMarkFldUpdate( const OutputDevice* );
+    SwRefMarkFldUpdate( OutputDevice* );
 };
 
 /** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 2aed426..129e955 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -49,7 +49,7 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
 {
 }
 
-SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
+SwRefMarkFldUpdate::SwRefMarkFldUpdate( OutputDevice* pOutput )
     : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
     pOut( pOutput )
 {
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 4d1557e..9ae2b19 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -438,7 +438,7 @@ namespace
 
         private:
             bool mbMapModeRestored;
-            OutputDevice* mpOutDev;
+            VclPtr<OutputDevice> mpOutDev;
     };
 }
 // <--
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ecdc339..325ca1c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -240,7 +240,7 @@ struct SwPaintProperties {
     // Only repaint the Fly content as well as the background of the Fly content if
     // a metafile is taken of the Fly.
     bool                bSFlyMetafile;
-    OutputDevice       *pSFlyMetafileOut;
+    VclPtr<OutputDevice> pSFlyMetafileOut;
     SwViewShell        *pSGlobalShell;
 
     // Retouch for transparent Flys is done by the background of the Flys.
@@ -1247,7 +1247,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
     }
 
     const OutputDevice *pOut = gProp.bSFlyMetafile ?
-                        gProp.pSFlyMetafileOut : pSh->GetOut();
+                        gProp.pSFlyMetafileOut.get() : pSh->GetOut();
 
     // Hold original rectangle in pixel
     const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx
index 8e68a81..ed5bbc2 100644
--- a/sw/source/core/layout/virtoutp.cxx
+++ b/sw/source/core/layout/virtoutp.cxx
@@ -133,8 +133,7 @@ bool SwLayVout::DoesFit( const Size &rNew )
         aSize.Width() = rNew.Width();
         if( !pVirDev->SetOutputSizePixel( aSize ) )
         {
-            delete pVirDev;
-            pVirDev = NULL;
+            pVirDev.disposeAndClear();
             aSize.Width() = 0;
             return false;
         }
diff --git a/sw/source/core/layout/virtoutp.hxx b/sw/source/core/layout/virtoutp.hxx
index 287cfaf..ea44b5b 100644
--- a/sw/source/core/layout/virtoutp.hxx
+++ b/sw/source/core/layout/virtoutp.hxx
@@ -43,7 +43,7 @@ private:
 
 public:
     SwLayVout() : pSh(0), pOut(0), pVirDev(0), aSize(0, VIRTUALHEIGHT), nCount(0) {}
-    ~SwLayVout() { delete pVirDev; }
+    ~SwLayVout() { pVirDev.disposeAndClear(); }
 
     /// OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const>
     void Enter( SwViewShell *pShell, SwRect &rRect, bool bOn );
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 2a97c44..58062ee 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -110,7 +110,7 @@ SwTxtAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const
 bool SwAttrIter::SeekAndChgAttrIter( const sal_Int32 nNewPos, OutputDevice* pOut )
 {
     bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos );
-    if ( pLastOut != pOut )
+    if ( pLastOut.get() != pOut )
     {
         pLastOut = pOut;
         pFnt->SetFntChg( true );
@@ -175,7 +175,7 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo
     }
 
     bool bChg = pFnt->IsFntChg();
-    if ( pLastOut != pOut )
+    if ( pLastOut.get() != pOut )
     {
         pLastOut = pOut;
         pFnt->SetFntChg( true );
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index d4925c1..3e9f2fc 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -90,8 +90,8 @@ private:
 public:
 
     EMFWriter(SvStream &rStream)
-        : m_rStm(rStream)
-        , maVDev( new VirtualDevice() )
+        : maVDev( new VirtualDevice() )
+        , m_rStm(rStream)
         , mpHandlesUsed(NULL)
         , mnHandleCount(0)
         , mnRecordCount(0)
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 0f38573..8db41bf 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -634,7 +634,7 @@ public:
         void SizeAndRender(OutputDevice &rDev, Rectangle r, RenderType eType,
                            const RenderContext &rCtx)
         {
-            VirtualDevice *pNested;
+            ScopedVclPtr<VirtualDevice> pNested;
 
             if ((int)eType < RENDER_AS_BITMAPEX)
                 pNested = new VirtualDevice(rDev);
@@ -664,7 +664,6 @@ public:
                                 aWhole.TopLeft(), aWhole.GetSize(),
                                 *pNested);
             }
-            delete pNested;
         }
         virtual void RenderRegion(OutputDevice &rDev, Rectangle r,
                                   const RenderContext &rCtx) SAL_OVERRIDE


More information about the Libreoffice-commits mailing list