[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 2 commits - dbaccess/source extensions/source extensions/workben vcl/source

Michael Meeks michael.meeks at collabora.com
Wed Apr 22 09:24:25 PDT 2015


 dbaccess/source/ui/browser/brwview.cxx              |    2 +-
 extensions/source/bibliography/bibbeam.cxx          |    4 ++--
 extensions/source/bibliography/bibcont.cxx          |    4 ++--
 extensions/source/bibliography/bibload.cxx          |    2 +-
 extensions/source/bibliography/bibview.cxx          |    2 +-
 extensions/source/bibliography/toolbar.cxx          |    8 ++++----
 extensions/source/plugin/base/plctrl.cxx            |    2 +-
 extensions/source/propctrlr/browserline.cxx         |    4 ++--
 extensions/source/propctrlr/browserlistbox.cxx      |    6 +++---
 extensions/source/propctrlr/browserpage.cxx         |    2 +-
 extensions/source/propctrlr/browserview.cxx         |    2 +-
 extensions/source/propctrlr/formlinkdialog.cxx      |    8 ++++----
 extensions/source/propctrlr/inspectorhelpwindow.cxx |    4 ++--
 extensions/source/propctrlr/propcontroller.cxx      |    2 +-
 extensions/source/propctrlr/propertyeditor.cxx      |    4 ++--
 extensions/source/propctrlr/standardcontrol.cxx     |    8 ++++----
 extensions/source/scanner/sanedlg.cxx               |    3 +--
 extensions/workben/testframecontrol.cxx             |    2 +-
 vcl/source/window/openglwin.cxx                     |    4 ++--
 19 files changed, 36 insertions(+), 37 deletions(-)

New commits:
commit 3f32e149d9f6f94473983bf294e73d6e5e3f6fe5
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Apr 22 17:20:25 2015 +0100

    extensions: convert new to ::Create.
    
    Change-Id: I8c438d62ae0fc2c1954c965966a39d4f98e6b871

diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
index d823da5..9e62350 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -224,7 +224,7 @@ namespace bib
 
     void BibBeamer::createToolBar()
     {
-        pToolBar= new BibToolBar(this, LINK( this, BibBeamer, RecalcLayout_Impl ));
+        pToolBar= VclPtr<BibToolBar>::Create(this, LINK( this, BibBeamer, RecalcLayout_Impl ));
         ::Size aSize=pToolBar->GetSizePixel();
         InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED );
         if ( m_xController.is() )
@@ -233,7 +233,7 @@ namespace bib
 
     void BibBeamer::createGridWin()
     {
-        pGridWin = new BibGridwin(this,0);
+        pGridWin = VclPtr<BibGridwin>::Create(this,0);
 
         InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE );
 
diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx
index 3699f31..5eba4ba 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -183,7 +183,7 @@ void BibBookContainer::createTopFrame( BibShortCutHandler* pWin )
         RemoveItem(TOP_WINDOW);
         pTopWin.disposeAndClear();
     }
-    pTopWin=new BibWindowContainer(this,pWin);
+    pTopWin=VclPtr<BibWindowContainer>::Create(this,pWin);
     pTopWin->Show();
     BibConfig* pConfig = BibModul::GetConfig();
     long nSize = pConfig->getBeamerSize();
@@ -201,7 +201,7 @@ void BibBookContainer::createBottomFrame( BibShortCutHandler* pWin )
         pBottomWin.disposeAndClear();
     }
 
-    pBottomWin=new BibWindowContainer(this,pWin);
+    pBottomWin=VclPtr<BibWindowContainer>::Create(this,pWin);
 
     BibConfig* pConfig = BibModul::GetConfig();
     long nSize = pConfig->getViewSize();
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index 98016ca..b481f05 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -273,7 +273,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
 
     vcl::Window* pParent = VCLUnoHelper::GetWindow( aWindow );
 
-    BibBookContainer *pMyWindow = new BibBookContainer( pParent );
+    VclPtrInstance<BibBookContainer> pMyWindow( pParent );
     pMyWindow->Show();
 
     ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 243161f..dd13a1e 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -119,7 +119,7 @@ namespace bib
             m_xGeneralPage = 0;
         }
 
-        m_pGeneralPage = new BibGeneralPage( this, m_pDatMan );
+        m_pGeneralPage = VclPtr<BibGeneralPage>::Create( this, m_pDatMan );
         m_xGeneralPage = &m_pGeneralPage->GetFocusListener();
         m_pGeneralPage->Show();
 
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 4dbc001..f6db180 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -180,10 +180,10 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
     ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
     aImgLst(BibResId(  RID_TOOLBAR_IMGLIST     )),
     aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )),
-    aFtSource(new FixedText(this,WB_VCENTER)),
-    aLBSource(new ListBox(this,WB_DROPDOWN)),
-    aFtQuery(new FixedText(this,WB_VCENTER)),
-    aEdQuery(new Edit(this)),
+    aFtSource(VclPtr<FixedText>::Create(this,WB_VCENTER)),
+    aLBSource(VclPtr<ListBox>::Create(this,WB_DROPDOWN)),
+    aFtQuery(VclPtr<FixedText>::Create(this,WB_VCENTER)),
+    aEdQuery(VclPtr<Edit>::Create(this)),
     nMenuId(0),
     nSelMenuItem(0),
     aLayoutManager( aLink ),
diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx
index b8973e0..626af3f 100644
--- a/extensions/source/plugin/base/plctrl.cxx
+++ b/extensions/source/plugin/base/plctrl.cxx
@@ -169,7 +169,7 @@ void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XTo
     vcl::Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer );
     if (pImpl)
     {
-        _pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN );
+        _pSysChild = VclPtr<SystemChildWindow>::Create( pImpl, WB_CLIPCHILDREN );
         if (pImpl->HasFocus())
             _pSysChild->GrabFocus();
 
diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx
index c322075..174c01e 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -55,7 +55,7 @@ namespace pcr
 
     OBrowserLine::OBrowserLine( const OUString& _rEntryName, vcl::Window* pParent )
             :m_sEntryName( _rEntryName )
-            ,m_aFtTitle(new FixedText(pParent))
+            ,m_aFtTitle(VclPtr<FixedText>::Create(pParent))
             ,m_pControlWindow( NULL )
             ,m_pBrowseButton(NULL)
             ,m_pAdditionalBrowseButton( NULL )
@@ -380,7 +380,7 @@ namespace pcr
 
         if ( !rpButton )
         {
-            rpButton = new PushButton( m_pTheParent, WB_NOPOINTERFOCUS );
+            rpButton = VclPtr<PushButton>::Create( m_pTheParent, WB_NOPOINTERFOCUS );
             rpButton->SetGetFocusHdl( LINK( this, OBrowserLine, OnButtonFocus ) );
             rpButton->SetClickHdl( LINK( this, OBrowserLine, OnButtonClicked ) );
             rpButton->SetText(OUString("..."));
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index f343e75..899a82d 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -345,9 +345,9 @@ namespace pcr
 
     OBrowserListBox::OBrowserListBox( vcl::Window* pParent, WinBits nWinStyle)
             :Control(pParent, nWinStyle| WB_CLIPCHILDREN)
-            ,m_aLinesPlayground(new vcl::Window(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN))
-            ,m_aVScroll(new ScrollBar(this,WB_VSCROLL|WB_REPEAT|WB_DRAG))
-            ,m_pHelpWindow( new InspectorHelpWindow( this ) )
+            ,m_aLinesPlayground(VclPtr<vcl::Window>::Create(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN))
+            ,m_aVScroll(VclPtr<ScrollBar>::Create(this,WB_VSCROLL|WB_REPEAT|WB_DRAG))
+            ,m_pHelpWindow( VclPtr<InspectorHelpWindow>::Create( this ) )
             ,m_pLineListener(NULL)
             ,m_pControlObserver( NULL )
             ,m_nYOffset(0)
diff --git a/extensions/source/propctrlr/browserpage.cxx b/extensions/source/propctrlr/browserpage.cxx
index f143b60..dfb0236 100644
--- a/extensions/source/propctrlr/browserpage.cxx
+++ b/extensions/source/propctrlr/browserpage.cxx
@@ -35,7 +35,7 @@ namespace pcr
 
     OBrowserPage::OBrowserPage(vcl::Window* pParent,WinBits nWinStyle)
             :TabPage(pParent,nWinStyle)
-            ,m_aListBox(new OBrowserListBox(this))
+            ,m_aListBox(VclPtr<OBrowserListBox>::Create(this))
     {
         m_aListBox->SetBackground(GetBackground());
         m_aListBox->SetPaintTransparent( true );
diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx
index 097ce69..ab512b4 100644
--- a/extensions/source/propctrlr/browserview.cxx
+++ b/extensions/source/propctrlr/browserview.cxx
@@ -35,7 +35,7 @@ namespace pcr
                   :Window(_pParent, nBits | WB_3DLOOK)
                   ,m_nActivePage(0)
     {
-        m_pPropBox = new OPropertyEditor( this );
+        m_pPropBox = VclPtr<OPropertyEditor>::Create( this );
         m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
         m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
 
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index fc7b229..1b1a5fd 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -168,10 +168,10 @@ namespace pcr
             const OUString& _sDetailLabel,
             const OUString& _sMasterLabel)
         :ModalDialog( _pParent, "FormLinks", "modules/spropctrlr/ui/formlinksdialog.ui" )
-        ,m_aRow1       ( new FieldLinkRow( get<VclVBox>("box") ) )
-        ,m_aRow2       ( new FieldLinkRow( get<VclVBox>("box") ) )
-        ,m_aRow3       ( new FieldLinkRow( get<VclVBox>("box") ) )
-        ,m_aRow4       ( new FieldLinkRow( get<VclVBox>("box") ) )
+        ,m_aRow1       ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+        ,m_aRow2       ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+        ,m_aRow3       ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+        ,m_aRow4       ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
         ,m_xContext    ( _rxContext )
         ,m_xDetailForm( _rxDetailForm )
         ,m_xMasterForm( _rxMasterForm )
diff --git a/extensions/source/propctrlr/inspectorhelpwindow.cxx b/extensions/source/propctrlr/inspectorhelpwindow.cxx
index 98324df..b174b69 100644
--- a/extensions/source/propctrlr/inspectorhelpwindow.cxx
+++ b/extensions/source/propctrlr/inspectorhelpwindow.cxx
@@ -29,8 +29,8 @@ namespace pcr
 
     InspectorHelpWindow::InspectorHelpWindow( vcl::Window* _pParent )
         :Window( _pParent, WB_DIALOGCONTROL )
-        ,m_aSeparator( new FixedLine(this) )
-        ,m_aHelpText( new MultiLineEdit(this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL) )
+        ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
+        ,m_aHelpText( VclPtr<MultiLineEdit>::Create(this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL) )
         ,m_nMinLines( 3 )
         ,m_nMaxLines( 8 )
     {
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 66cea9ec..dc85415 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -703,7 +703,7 @@ namespace pcr
         DBG_ASSERT(!haveView(), "OPropertyBrowserController::Construct: already have a view!");
         DBG_ASSERT(_pParentWin, "OPropertyBrowserController::Construct: invalid parent window!");
 
-        m_pView = new OPropertyBrowserView(_pParentWin);
+        m_pView = VclPtr<OPropertyBrowserView>::Create(_pParentWin);
         m_pView->setPageActivationHandler(LINK(this, OPropertyBrowserController, OnPageActivation));
 
         // add as dispose listener for our view. The view is disposed by the frame we're plugged into,
diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx
index 7e7bee0..3f8675c 100644
--- a/extensions/source/propctrlr/propertyeditor.cxx
+++ b/extensions/source/propctrlr/propertyeditor.cxx
@@ -43,7 +43,7 @@ namespace pcr
 
     OPropertyEditor::OPropertyEditor( vcl::Window* pParent, WinBits nWinStyle)
             :Control(pParent, nWinStyle)
-            ,m_aTabControl( new TabControl(this) )
+            ,m_aTabControl( VclPtr<TabControl>::Create(this) )
             ,m_pListener(NULL)
             ,m_pObserver(NULL)
             ,m_nNextId(1)
@@ -221,7 +221,7 @@ namespace pcr
         m_aTabControl->InsertPage(nId, _rText);
 
         // create a new page
-        OBrowserPage* pPage = new OBrowserPage(m_aTabControl.get());
+        VclPtrInstance<OBrowserPage> pPage(m_aTabControl.get());
         pPage->SetText( _rText );
         // some knittings
         pPage->SetSizePixel(m_aTabControl->GetTabPageSizePixel());
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index f3cc6a2..fe0313d 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -977,7 +977,7 @@ namespace pcr
 
     OMultilineFloatingEdit::OMultilineFloatingEdit(vcl::Window* _pParent)
         :FloatingWindow(_pParent, WB_BORDER)
-        ,m_aImplEdit(new MultiLineEdit(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER))
+        ,m_aImplEdit(VclPtr<MultiLineEdit>::Create(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER))
     {
         m_aImplEdit->Show();
     }
@@ -1041,19 +1041,19 @@ namespace pcr
     {
         SetCompoundControl( true );
 
-        m_pImplEdit = new MultiLineEdit( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) );
+        m_pImplEdit = VclPtr<MultiLineEdit>::Create( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) );
         SetSubEdit( m_pImplEdit );
         m_pImplEdit->Show();
 
         if ( _nStyle & WB_DROPDOWN )
         {
-            m_pDropdownButton = new PushButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
+            m_pDropdownButton = VclPtr<PushButton>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
             m_pDropdownButton->SetSymbol(SymbolType::SPIN_DOWN);
             m_pDropdownButton->SetClickHdl( LINK( this, DropDownEditControl, DropDownHdl ) );
             m_pDropdownButton->Show();
         }
 
-        m_pFloatingEdit = new OMultilineFloatingEdit(this); //FloatingWindow
+        m_pFloatingEdit = VclPtr<OMultilineFloatingEdit>::Create(this);
 
         m_pFloatingEdit->SetPopupModeEndHdl( LINK( this, DropDownEditControl, ReturnHdl ) );
         m_pFloatingEdit->getEdit().SetReadOnly( ( _nStyle & WB_READONLY ) != 0 );
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index b6edcb0..9034f00 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -157,8 +157,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScanPreview(vcl::Windo
     OString sBorder = VclBuilder::extractCustomProperty(rMap);
     if (!sBorder.isEmpty())
         nWinStyle |= WB_BORDER;
-    ScanPreview *pWindow = new ScanPreview(pParent, nWinStyle);
-    return pWindow;
+    return new ScanPreview(pParent, nWinStyle);
 }
 
 SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
diff --git a/extensions/workben/testframecontrol.cxx b/extensions/workben/testframecontrol.cxx
index bb22d17..5cfa08c 100644
--- a/extensions/workben/testframecontrol.cxx
+++ b/extensions/workben/testframecontrol.cxx
@@ -239,7 +239,7 @@ void FrameControlApplication::init()
     XInterfaceRef xInst = xMgr->createInstance( L"stardiv.one.frame.FrameControl" );
     if (xInst->queryInterface( XControl::getSmartUik(), _xControl ))
     {
-        _pWorkWin = new WorkWindow( NULL, WB_APP | WB_STDWORK );
+        _pWorkWin = VclPtr<WorkWindow>::Create( nullptr, WB_APP | WB_STDWORK );
         _pWorkWin->Show();
         XWindowPeerRef xParent( _pWorkWin->GetComponentInterface() );
 
commit 8387e5bd93d1181d1da39b3075ab09b421e26ab4
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Apr 22 17:19:42 2015 +0100

    Fix lifecycle issues.
    
    Change-Id: I7524ca3da7d134d94553be0e7a6db7e879984ae8

diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index a940238..fe0ad00 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -159,7 +159,7 @@ void UnoDataBrowserView::setTreeView(DBTreeView* _pTreeView)
 {
     if (m_pTreeView.get() != _pTreeView)
     {
-        m_pTreeView.clear();
+        m_pTreeView.disposeAndClear();
         m_pTreeView = _pTreeView;
     }
 }
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 1ef46da..21af6cc 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -16,6 +16,7 @@ class OpenGLWindowImpl
 {
 public:
     OpenGLWindowImpl(vcl::Window* pWindow);
+    ~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); }
     OpenGLContext& getContext() { return maContext;}
 private:
     OpenGLContext maContext;
@@ -31,7 +32,6 @@ OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
     pWindow->SetMouseTransparent(false);
 }
 
-
 OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
     Window(pParent, 0),
     mxImpl(new OpenGLWindowImpl(this)),
@@ -49,7 +49,7 @@ void OpenGLWindow::dispose()
     if(mpRenderer)
         mpRenderer->contextDestroyed();
     mpRenderer = NULL;
-
+    mxImpl.reset();
     Window::dispose();
 }
 


More information about the Libreoffice-commits mailing list