[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 3 commits - avmedia/source basctl/source canvas/source formula/source include/avmedia include/sfx2 include/svx sc/source sd/source sfx2/inc sfx2/source svx/source sw/source

Michael Meeks michael.meeks at collabora.com
Thu Apr 16 13:45:19 PDT 2015


 avmedia/source/framework/mediacontrol.cxx  |   14 ++++++------
 avmedia/source/framework/mediaplayer.cxx   |    2 -
 avmedia/source/framework/mediatoolbox.cxx  |    4 +--
 avmedia/source/viewer/mediawindow.cxx      |    2 -
 avmedia/source/viewer/mediawindow_impl.cxx |    6 ++---
 basctl/source/basicide/basicbox.cxx        |    8 +++----
 basctl/source/basicide/basicbox.hxx        |    4 +--
 canvas/source/directx/dx_9rm.cxx           |    3 +-
 canvas/source/vcl/backbuffer.cxx           |    2 -
 canvas/source/vcl/bitmapbackbuffer.cxx     |    4 +--
 formula/source/ui/dlg/formula.cxx          |    6 ++---
 formula/source/ui/dlg/funcutl.cxx          |    2 -
 include/avmedia/mediatoolbox.hxx           |    2 -
 include/sfx2/tbxctrl.hxx                   |    4 +--
 include/svx/fillctrl.hxx                   |    2 -
 include/svx/grafctrl.hxx                   |    4 +--
 include/svx/linectrl.hxx                   |    4 +--
 include/svx/tbcontrl.hxx                   |    4 +--
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx    |    6 ++---
 sc/source/ui/inc/tbzoomsliderctrl.hxx      |    2 -
 sc/source/ui/view/prevwsh.cxx              |    2 -
 sd/source/ui/dlg/diactrl.cxx               |    4 +--
 sd/source/ui/dlg/gluectrl.cxx              |    8 ++-----
 sd/source/ui/inc/diactrl.hxx               |    2 -
 sd/source/ui/inc/gluectrl.hxx              |    2 -
 sfx2/inc/inettbc.hxx                       |    2 -
 sfx2/source/inet/inettbc.cxx               |    7 ++----
 sfx2/source/toolbox/tbxitem.cxx            |    4 +--
 svx/source/form/tbxform.cxx                |   20 +++++++++---------
 svx/source/inc/tbxform.hxx                 |    8 +++----
 svx/source/tbxctrls/fillctrl.cxx           |    8 +++----
 svx/source/tbxctrls/grafctrl.cxx           |    8 +++----
 svx/source/tbxctrls/linectrl.cxx           |    8 +++----
 svx/source/tbxctrls/tbcontrl.cxx           |   32 ++++++++++++++---------------
 sw/source/uibase/inc/workctrl.hxx          |    2 -
 sw/source/uibase/ribbar/workctrl.cxx       |    6 ++---
 36 files changed, 103 insertions(+), 105 deletions(-)

New commits:
commit 4a33504d31a24fead3191b9aa6602bde86ef3d17
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 21:48:48 2015 +0100

    formula & canvas: convert new to ::Create to get initial ref-counting right.
    
    Change-Id: I96e2e59c2f880632cf719f3346e345a5d03cc858

diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index b9ee883..34e3938 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -666,7 +666,8 @@ namespace dxcanvas
             maVertexCache.reserve(1024);
 
             mpWindow.reset(
-                new SystemChildWindow(
+                VclPtr<SystemChildWindow>::Create(
+
                 const_cast<vcl::Window *>(&rWindow), 0) );
 
             // system child window must not receive mouse events
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 216b5eb..356caa9 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -25,7 +25,7 @@ namespace vclcanvas
 {
     BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
                             bool                bMonochromeBuffer ) :
-        maVDev( new VirtualDevice( rRefDevice,
+        maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
                                    sal_uInt16(bMonochromeBuffer) ) )
     {
         if( !bMonochromeBuffer )
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx
index 1bbf73c..bd01d71 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -112,8 +112,8 @@ namespace vclcanvas
             // VDev not yet created, do it now. Create an alpha-VDev,
             // if bitmap has transparency.
             mpVDev = maBitmap->IsTransparent() ?
-                new VirtualDevice( mrRefDevice, 0, 0 ) :
-                new VirtualDevice( mrRefDevice );
+                VclPtr<VirtualDevice>::Create( mrRefDevice, 0, 0 ) :
+                VclPtr<VirtualDevice>::Create( mrRefDevice );
 
             OSL_ENSURE( mpVDev,
                         "BitmapBackBuffer::createVDev(): Unable to create VirtualDevice" );
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 5e2f388..7f20431 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -286,7 +286,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     pParent->get(m_pRefBtn, "RB_REF");
     m_pRefBtn->SetReferences(_pDlg, m_pEdRef);
 
-    pParaWin = new ParaWin(m_pParaWinBox, _pDlg);
+    pParaWin = VclPtr<ParaWin>::Create(m_pParaWinBox, _pDlg);
     pParaWin->Show();
     m_pParaWinBox->Hide();
     m_pFtEditName->Hide();
@@ -306,8 +306,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     pParaWin->SetArgModifiedHdl(LINK( this, FormulaDlg_Impl, ModifyHdl ) );
     pParaWin->SetFxHdl(LINK( this, FormulaDlg_Impl, FxHdl ) );
 
-    pFuncPage= new FuncPage( m_pTabCtrl,_pFunctionMgr);
-    pStructPage= new StructPage( m_pTabCtrl);
+    pFuncPage= VclPtr<FuncPage>::Create( m_pTabCtrl,_pFunctionMgr);
+    pStructPage= VclPtr<StructPage>::Create( m_pTabCtrl);
     pFuncPage->Hide();
     pStructPage->Hide();
     m_pTabCtrl->SetTabPage( TP_FUNCTION, pFuncPage);
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 716dc88..271d8b8 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -353,7 +353,7 @@ EditBox::EditBox( vcl::Window* pParent, WinBits nBits )
     WinBits nStyle=GetStyle();
     SetStyle( nStyle| WB_DIALOGCONTROL);
 
-    pMEdit=new MultiLineEdit(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) |
+    pMEdit=VclPtr<MultiLineEdit>::Create(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) |
                     WB_NOBORDER | WB_NOHIDESELECTION | WB_IGNORETAB);
     pMEdit->Show();
     aOldSel=pMEdit->GetSelection();
commit d24f93dcf004dc81d4d5e9acec0b4e663fa09cd8
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 21:05:18 2015 +0100

    make CreateItemWindow return a VclPtr<>.
    
    Change-Id: Id15ff8900376aaee4343d7ee08ae062e1c462ce4

diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx
index 7adfb4e..28adf19 100644
--- a/avmedia/source/framework/mediaplayer.cxx
+++ b/avmedia/source/framework/mediaplayer.cxx
@@ -40,7 +40,7 @@ namespace avmedia
 MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) :
     SfxChildWindow( _pParent, nId )
 {
-    pWindow = VclPtr<MediaFloater>::Create( _pBindings, this, _pParent );
+    pWindow.reset( VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ) );
     eChildAlignment = SfxChildAlignment::NOALIGNMENT;
     static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo );
 };
diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx
index 124da20..4f20a78 100644
--- a/avmedia/source/framework/mediatoolbox.cxx
+++ b/avmedia/source/framework/mediatoolbox.cxx
@@ -124,9 +124,9 @@ void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eSta
 
 
 
-vcl::Window* MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL );
+    return ( pParent ? VclPtr<MediaToolBoxControl_Impl>::Create( *pParent, *this ) : nullptr );
 }
 
 
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index 615aed4..a774c1b 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -65,9 +65,9 @@ void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPool
 
 
 
-vcl::Window* LibBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> LibBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return new LibBox( pParent, m_xFrame );
+    return VclPtr<LibBox>::Create( pParent, m_xFrame );
 }
 
 
@@ -362,9 +362,9 @@ void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, cons
     }
 }
 
-vcl::Window* LanguageBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> LanguageBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return new LanguageBox( pParent );
+    return VclPtr<LanguageBox>::Create( pParent );
 }
 
 // class basctl::LanguageBox -----------------------------------------------
diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx
index f13e0ea..1f87750 100644
--- a/basctl/source/basicide/basicbox.hxx
+++ b/basctl/source/basicide/basicbox.hxx
@@ -36,7 +36,7 @@ public:
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                       const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 /** base class for list boxes which need to update their content according to the list
@@ -110,7 +110,7 @@ public:
                         LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 class LanguageBox : public DocListenerBox
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
index 4c51297..fb61d33 100644
--- a/include/avmedia/mediatoolbox.hxx
+++ b/include/avmedia/mediatoolbox.hxx
@@ -45,7 +45,7 @@ public:
                                 virtual ~MediaToolBoxControl();
 
     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*             CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
 private:
 
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 6061a5b..5284bcc 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -203,7 +203,7 @@ protected:
     virtual SfxPopupWindowType GetPopupWindowType() const;
     virtual SfxPopupWindow*    CreatePopupWindow();
     virtual SfxPopupWindow*    CreatePopupWindowCascading();
-    virtual vcl::Window*            CreateItemWindow( vcl::Window *pParent );
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent );
 
     // Must be called by subclass to set a new popup window instance
     void                       SetPopupWindow( SfxPopupWindow* pWindow );
@@ -306,7 +306,7 @@ class SfxDragToolBoxControl_Impl : public SfxToolBoxControl
 public:
                             SFX_DECL_TOOLBOX_CONTROL();
                             SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox );
-    virtual vcl::Window*         CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
     virtual void            Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
 };
 
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index fd7e5a0..f196248 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -67,7 +67,7 @@ public:
 
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
     void Update(const SfxPoolItem* pState);
-    virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx
index acfd5f3..473133b 100644
--- a/include/svx/grafctrl.hxx
+++ b/include/svx/grafctrl.hxx
@@ -68,7 +68,7 @@ public:
     virtual ~SvxGrafToolBoxControl();
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 
@@ -160,7 +160,7 @@ public:
                         virtual ~SvxGrafModeToolBoxControl();
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index a853dd8..4b5ccec 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -52,7 +52,7 @@ public:
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                       const SfxPoolItem* pState ) SAL_OVERRIDE;
     void                Update( const SfxPoolItem* pState );
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 
@@ -69,7 +69,7 @@ public:
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                       const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 329bb20..28358d2 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -163,7 +163,7 @@ public:
     SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     virtual ~SvxStyleToolBoxControl();
 
-    virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
 
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
                               const SfxPoolItem* pState) SAL_OVERRIDE;
@@ -210,7 +210,7 @@ public:
 
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
                               const SfxPoolItem* pState) SAL_OVERRIDE;
-    virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
 };
 
 class BorderColorStatus
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 618a5af..b93ec72 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -79,14 +79,14 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState
     }
 }
 
-vcl::Window* ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent )
 {
     // #i98000# Don't try to get a value via SfxViewFrame::Current here.
     // The view's value is always notified via StateChanged later.
-    ScZoomSliderWnd* pSlider    = new ScZoomSliderWnd( pParent,
+    VclPtrInstance<ScZoomSliderWnd> pSlider( pParent,
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(),
         ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 );
-    return  pSlider;
+    return pSlider.get();
 }
 
 struct ScZoomSliderWnd::ScZoomSliderWnd_Impl
diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx
index 442202d..0768db7 100644
--- a/sc/source/ui/inc/tbzoomsliderctrl.hxx
+++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx
@@ -34,7 +34,7 @@ public:
     virtual ~ScZoomSliderControl();
 
     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 
 class ScZoomSliderWnd: public vcl::Window
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 225b003..5dc88fc 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -537,7 +537,7 @@ VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent,
     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
     ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
     if ( ScTpPrintOptionsCreate )
-        return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions)
+        return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions),
                                   SAL_NO_ACQUIRE);
     return VclPtr<SfxTabPage>();
 }
diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx
index 41c2754..e2307ac 100644
--- a/sd/source/ui/dlg/diactrl.cxx
+++ b/sd/source/ui/dlg/diactrl.cxx
@@ -132,9 +132,9 @@ void SdTbxCtlDiaPages::StateChanged( sal_uInt16,
     }
 }
 
-vcl::Window* SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent )
 {
-    return new SdPagesField( pParent, m_xFrame );
+    return VclPtrInstance<SdPagesField>( pParent, m_xFrame ).get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index b21f710..181dd7a 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId,
     SfxToolBoxControl::StateChanged( nSId, eState, pState );
 }
 
-vcl::Window* SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent )
 {
     if( GetSlotId() == SID_GLUE_ESCDIR )
-    {
-        return new GlueEscDirLB( pParent, m_xFrame );
-    }
+        return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get();
 
-    return NULL;
+    return VclPtr<vcl::Window>();
 }
 
 /**
diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx
index fdb61e8..a6f6006 100644
--- a/sd/source/ui/inc/diactrl.hxx
+++ b/sd/source/ui/inc/diactrl.hxx
@@ -55,7 +55,7 @@ class SdTbxCtlDiaPages : public SfxToolBoxControl
 public:
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                       const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 
     SFX_DECL_TOOLBOX_CONTROL();
 
diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx
index d3b2e0a..fde273c 100644
--- a/sd/source/ui/inc/gluectrl.hxx
+++ b/sd/source/ui/inc/gluectrl.hxx
@@ -51,7 +51,7 @@ private:
 public:
     virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
                                 const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 
             SFX_DECL_TOOLBOX_CONTROL();
 
diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx
index 9bcfe6a..dcc6b11 100644
--- a/sfx2/inc/inettbc.hxx
+++ b/sfx2/inc/inettbc.hxx
@@ -53,7 +53,7 @@ public:
                             SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
     virtual                 ~SfxURLToolBoxControl_Impl();
 
-    virtual vcl::Window*         CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
     virtual void            StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
 };
 
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 29a5168..81f89fb 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -152,13 +152,12 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, Execute
 }
 
 
-vcl::Window* SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
 {
-    SvtURLBox* pURLBox = new SvtURLBox( pParent );
+    VclPtrInstance<SvtURLBox> pURLBox( pParent );
     pURLBox->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) );
     pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) );
-
-    return pURLBox;
+    return pURLBox.get();
 }
 
 IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl)
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 4fedbfa..f229d8d 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -989,9 +989,9 @@ SfxPopupWindow* SfxToolBoxControl::CreatePopupWindowCascading()
 
 
 
-vcl::Window* SfxToolBoxControl::CreateItemWindow( vcl::Window * )
+VclPtr<vcl::Window> SfxToolBoxControl::CreateItemWindow( vcl::Window * )
 {
-    return 0;
+    return VclPtr<vcl::Window>();
 }
 
 
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index 6cd514a..98e4ea2 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -270,11 +270,11 @@ void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, cons
 }
 
 
-vcl::Window* SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent )
 {
-    SvxFmAbsRecWin* pWin = new SvxFmAbsRecWin( pParent, this );
+    VclPtrInstance<SvxFmAbsRecWin> pWin( pParent, this );
     pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW );
-    return pWin;
+    return pWin.get();
 }
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem );
@@ -290,10 +290,10 @@ SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText()
 }
 
 
-vcl::Window* SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent )
 {
     OUString aText(SVX_RESSTR(RID_STR_REC_TEXT));
-    FixedText* pFixedText = new FixedText( pParent );
+    VclPtrInstance<FixedText> pFixedText( pParent );
     Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
     pFixedText->SetText( aText );
     aSize.Width() += 6;
@@ -316,16 +316,16 @@ SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText()
 }
 
 
-vcl::Window* SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent )
 {
     OUString aText(SVX_RESSTR(RID_STR_REC_FROM_TEXT));
-    FixedText* pFixedText = new FixedText( pParent, WB_CENTER );
+    VclPtrInstance<FixedText> pFixedText( pParent, WB_CENTER );
     Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
     aSize.Width() += 12;
     pFixedText->SetText( aText );
     pFixedText->SetSizePixel( aSize );
     pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
-    return pFixedText;
+    return pFixedText.get();
 }
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem );
@@ -343,9 +343,9 @@ SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal()
 }
 
 
-vcl::Window* SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent )
 {
-    pFixedText = new FixedText( pParent );
+    pFixedText.reset(VclPtr<FixedText>::Create( pParent ));
     OUString aSample("123456");
     Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
     aSize.Width() += 12;
diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx
index 0014ba6..a1877d8 100644
--- a/svx/source/inc/tbxform.hxx
+++ b/svx/source/inc/tbxform.hxx
@@ -71,7 +71,7 @@ public:
     SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
     virtual ~SvxFmTbxCtlAbsRec();
 
-    virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                   const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -86,7 +86,7 @@ public:
     SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
     virtual ~SvxFmTbxCtlRecText();
 
-    virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 };
 
 
@@ -98,7 +98,7 @@ public:
     SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
     virtual ~SvxFmTbxCtlRecFromText();
 
-    virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 };
 
 
@@ -112,7 +112,7 @@ public:
     SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
     virtual ~SvxFmTbxCtlRecTotal();
 
-    virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                   const SfxPoolItem* pState ) SAL_OVERRIDE;
 };
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index bd0ca39..54c9604 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -502,11 +502,11 @@ void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
     }
 }
 
-vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
+VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
 {
     if(GetSlotId() == SID_ATTR_FILL_STYLE)
     {
-        mpFillControl = new FillControl(pParent);
+        mpFillControl.reset(VclPtr<FillControl>::Create(pParent));
         // Thus the FillControl is known by SvxFillToolBoxControl
         // (and in order to remain compatible)
         mpFillControl->SetData(this);
@@ -528,9 +528,9 @@ vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
             mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID);
         }
 
-        return mpFillControl;
+        return mpFillControl.get();
     }
-    return NULL;
+    return VclPtr<vcl::Window>();
 }
 
 FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index c7306c0..c73aedd 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -487,9 +487,9 @@ void SvxGrafToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const
     }
 }
 
-vcl::Window* SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return( new ImplGrafControl( pParent, m_aCommandURL, m_xFrame ) );
+    return VclPtr<ImplGrafControl>::Create( pParent, m_aCommandURL, m_xFrame ).get();
 }
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item );
@@ -574,9 +574,9 @@ void SvxGrafModeToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, c
     }
 }
 
-vcl::Window* SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return( new ImplGrafModeControl( pParent, m_xFrame ) );
+    return VclPtr<ImplGrafModeControl>::Create( pParent, m_xFrame ).get();
 }
 
 void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index fb591df..8a360f5 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -183,9 +183,9 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
 
 
 
-vcl::Window* SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return new SvxLineBox( pParent, m_xFrame );
+    return VclPtr<SvxLineBox>::Create( pParent, m_xFrame ).get();
 }
 
 SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl(
@@ -244,9 +244,9 @@ void SvxLineWidthToolBoxControl::StateChanged(
 
 
 
-vcl::Window* SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    return( new SvxMetricField( pParent, m_xFrame ) );
+    return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
 }
 
 SvxLineEndWindow::SvxLineEndWindow(
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index db4067c..f9d8ce8 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2374,22 +2374,22 @@ void SvxStyleToolBoxControl::StateChanged(
         Update();
 }
 
-vcl::Window* SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
-{
-    SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent,
-                                                   OUString( ".uno:StyleApply" ),
-                                                   SFX_STYLE_FAMILY_PARA,
-                                                   Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
-                                                   m_xFrame,
-                                                   pImpl->aClearForm,
-                                                   pImpl->aMore,
-                                                   pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
+VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+{
+    VclPtrInstance<SvxStyleBox_Impl> pBox( pParent,
+                                           OUString( ".uno:StyleApply" ),
+                                           SFX_STYLE_FAMILY_PARA,
+                                           Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+                                           m_xFrame,
+                                           pImpl->aClearForm,
+                                           pImpl->aMore,
+                                           pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
     if( !pImpl->aDefaultStyles.empty())
         pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] );
     // Set visibility listener to bind/unbind controller
     pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification ));
 
-    return pBox;
+    return pBox.get();
 }
 
 SvxFontNameToolBoxControl::SvxFontNameToolBoxControl(
@@ -2434,12 +2434,12 @@ void SvxFontNameToolBoxControl::StateChanged(
     rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
 }
 
-vcl::Window* SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent )
 {
-    SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent,
-                                                         Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
-                                                         m_xFrame,0);
-    return pBox;
+    VclPtrInstance<SvxFontNameBox_Impl> pBox( pParent,
+                                              Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+                                              m_xFrame,0);
+    return pBox.get();
 }
 
 /* Note:
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index ba68c1f..201510c 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -181,7 +181,7 @@ public:
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
 
-    virtual vcl::Window*         CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
 };
 #endif
 
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 8fe62f9..3b5bc23 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -716,10 +716,10 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/,
     }
 }
 
-vcl::Window* SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent )
 {
-    SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
-    return pRet;
+    VclPtrInstance<SwZoomBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
+    return pRet.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 384e705a9e1e41dd859d22a09293c65a28ef6535
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 21:04:34 2015 +0100

    avmedia: convert new to ::Create to get initial ref-counting right.
    
    Change-Id: If7441005123ba1427d308b999af84b0c55a94a07

diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index e6c680e..5168c12 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -65,13 +65,13 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
     Control( pParent ),
     maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ),
     maItem( 0, AVMediaSetMask::ALL ),
-    maPlayToolBox( new ToolBox(this, WB_3DLOOK) ),
-    maTimeSlider( new Slider(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ),
-    maMuteToolBox( new ToolBox(this, WB_3DLOOK) ),
-    maVolumeSlider( new Slider(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ),
-    maZoomToolBox( new ToolBox(this, WB_3DLOOK) ),
-    mpZoomListBox( new ListBox( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
-    maTimeEdit( new Edit(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ),
+    maPlayToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+    maTimeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ),
+    maMuteToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+    maVolumeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ),
+    maZoomToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+    mpZoomListBox( VclPtr<ListBox>::Create( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
+    maTimeEdit( VclPtr<Edit>::Create(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ),
     meControlStyle( eControlStyle ),
     mbLocked( false )
 {
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx
index 6f1108a..7adfb4e 100644
--- a/avmedia/source/framework/mediaplayer.cxx
+++ b/avmedia/source/framework/mediaplayer.cxx
@@ -40,7 +40,7 @@ namespace avmedia
 MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) :
     SfxChildWindow( _pParent, nId )
 {
-    pWindow = new MediaFloater( _pBindings, this, _pParent );
+    pWindow = VclPtr<MediaFloater>::Create( _pBindings, this, _pParent );
     eChildAlignment = SfxChildAlignment::NOALIGNMENT;
     static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo );
 };
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 4023447..267e39f 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -46,7 +46,7 @@ namespace avmedia {
 
 
 MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) :
-    mpImpl( new priv::MediaWindowImpl( parent, this, bInternalMediaControl ) )
+    mpImpl( VclPtr<priv::MediaWindowImpl>::Create( parent, this, bInternalMediaControl ) )
 {
     mpImpl->Show();
 }
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 4d5eaa4..c84849b 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -156,7 +156,7 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo
     mpMediaWindow( pMediaWindow ),
     mpEvents( NULL ),
     mbEventTransparent(true),
-    mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ),
+    mpMediaWindowControl( bInternalMediaControl ? VclPtr<MediaWindowControl>::Create( this ) : nullptr ),
     mpEmptyBmpEx( NULL ),
     mpAudioBmpEx( NULL )
 {
@@ -509,14 +509,14 @@ void MediaWindowImpl::onURLChanged()
     if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON )
     {
         mpChildWindow.disposeAndClear();
-        mpChildWindow.reset(new MediaChildWindow(this) );
+        mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this) );
     }
 #if HAVE_FEATURE_GLTF
     else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON )
     {
         SystemWindowData aWinData = OpenGLContext::generateWinData(this, false);
         mpChildWindow.disposeAndClear();
-        mpChildWindow.reset(new MediaChildWindow(this,&aWinData));
+        mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this,&aWinData));
         mbEventTransparent = false;
     }
 #endif


More information about the Libreoffice-commits mailing list