[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 13 commits - accessibility/source avmedia/source basctl/source basic/source chart2/source compilerplugins/clang cui/source dbaccess/source desktop/source extensions/source include/vcl reportdesign/source sc/source sd/source sfx2/source starmath/source svtools/source svx/source sw/source uui/source vcl/source vcl/unx vcl/workben xmlsecurity/source

Noel Grandin noel at peralex.com
Fri Apr 10 03:53:42 PDT 2015


 accessibility/source/standard/vclxaccessiblebox.cxx        |   12 +-
 avmedia/source/framework/mediacontrol.cxx                  |    2 
 basctl/source/basicide/basidesh.cxx                        |   24 +++--
 basctl/source/basicide/basobj2.cxx                         |    4 
 basctl/source/basicide/macrodlg.cxx                        |    2 
 basctl/source/basicide/moduldl2.cxx                        |    4 
 basctl/source/basicide/moduldlg.cxx                        |    2 
 basic/source/runtime/inputbox.cxx                          |    2 
 basic/source/runtime/methods.cxx                           |    2 
 chart2/source/controller/main/ShapeController.cxx          |    8 -
 compilerplugins/clang/vclwidgets.cxx                       |   58 +++++++++----
 cui/source/customize/cfg.cxx                               |   18 ++--
 cui/source/customize/macropg.cxx                           |    4 
 cui/source/dialogs/SpellDialog.cxx                         |    2 
 cui/source/dialogs/cuigaldlg.cxx                           |    4 
 cui/source/dialogs/scriptdlg.cxx                           |    8 -
 cui/source/factory/dlgfact.cxx                             |    5 -
 cui/source/factory/dlgfact.hxx                             |    3 
 cui/source/factory/init.cxx                                |    2 
 cui/source/options/optjava.cxx                             |    4 
 cui/source/tabpages/autocdlg.cxx                           |    6 -
 cui/source/tabpages/chardlg.cxx                            |    2 
 cui/source/tabpages/numpages.cxx                           |    2 
 cui/source/tabpages/tpbitmap.cxx                           |    6 -
 cui/source/tabpages/tpcolor.cxx                            |    2 
 cui/source/tabpages/tpgradnt.cxx                           |    4 
 cui/source/tabpages/tphatch.cxx                            |    4 
 cui/source/tabpages/tplnedef.cxx                           |    2 
 dbaccess/source/ui/app/AppController.cxx                   |    5 -
 dbaccess/source/ui/app/AppDetailPageHelper.cxx             |   11 +-
 dbaccess/source/ui/app/AppTitleWindow.cxx                  |    1 
 dbaccess/source/ui/browser/genericcontroller.cxx           |    1 
 dbaccess/source/ui/control/FieldDescControl.cxx            |    9 --
 dbaccess/source/ui/misc/WCopyTable.cxx                     |    6 -
 dbaccess/source/ui/querydesign/JoinController.cxx          |    5 -
 dbaccess/source/ui/querydesign/JoinTableView.cxx           |    9 --
 dbaccess/source/ui/querydesign/QueryTableView.cxx          |    6 -
 dbaccess/source/ui/querydesign/QueryViewSwitch.cxx         |    8 -
 dbaccess/source/ui/relationdesign/RelationTableView.cxx    |    8 -
 desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx |    8 -
 desktop/source/deployment/gui/dp_gui_service.cxx           |    2 
 desktop/source/deployment/gui/license_dialog.cxx           |    2 
 extensions/source/bibliography/bibbeam.cxx                 |    4 
 extensions/source/bibliography/bibcont.cxx                 |   12 +-
 extensions/source/bibliography/datman.cxx                  |    4 
 extensions/source/propctrlr/formcomponenthandler.cxx       |    2 
 extensions/source/propctrlr/propertyeditor.cxx             |    9 --
 include/vcl/builder.hxx                                    |    2 
 include/vcl/layout.hxx                                     |    1 
 include/vcl/window.hxx                                     |    2 
 reportdesign/source/ui/dlg/Formula.cxx                     |    3 
 reportdesign/source/ui/report/DesignView.cxx               |   10 --
 reportdesign/source/ui/report/ReportController.cxx         |    1 
 sc/source/ui/condformat/condformatmgr.cxx                  |    4 
 sc/source/ui/dbgui/pvfundlg.cxx                            |    2 
 sc/source/ui/docshell/docsh4.cxx                           |    2 
 sc/source/ui/miscdlgs/optsolver.cxx                        |    2 
 sc/source/ui/miscdlgs/retypepassdlg.cxx                    |    8 -
 sc/source/ui/miscdlgs/scuiautofmt.cxx                      |    4 
 sc/source/ui/pagedlg/tphf.cxx                              |    2 
 sc/source/ui/view/cellsh1.cxx                              |    2 
 sc/source/ui/view/tabvwsh3.cxx                             |    8 -
 sc/source/ui/view/tabvwshh.cxx                             |    2 
 sd/source/ui/animations/CustomAnimationPane.cxx            |    4 
 sd/source/ui/dlg/sdpreslt.cxx                              |    2 
 sd/source/ui/slidesorter/view/SlideSorterView.cxx          |    4 
 sd/source/ui/table/TableDesignPane.cxx                     |    2 
 sfx2/source/appl/childwin.cxx                              |    6 -
 sfx2/source/appl/sfxhelp.cxx                               |    6 -
 sfx2/source/control/thumbnailview.cxx                      |    4 
 sfx2/source/dialog/dinfdlg.cxx                             |    2 
 sfx2/source/dialog/infobar.cxx                             |    1 
 sfx2/source/dialog/templdlg.cxx                            |    2 
 sfx2/source/dialog/versdlg.cxx                             |    6 -
 sfx2/source/doc/doctemplates.cxx                           |    4 
 sfx2/source/doc/objserv.cxx                                |   12 +-
 sfx2/source/sidebar/Deck.cxx                               |   15 +--
 sfx2/source/sidebar/Panel.cxx                              |    3 
 sfx2/source/sidebar/SidebarController.cxx                  |   12 +-
 sfx2/source/sidebar/TabBar.cxx                             |    6 -
 sfx2/source/toolbox/tbxitem.cxx                            |    6 -
 sfx2/source/view/viewfrm.cxx                               |    3 
 sfx2/source/view/viewprn.cxx                               |    4 
 starmath/source/dialog.cxx                                 |    4 
 starmath/source/document.cxx                               |    8 -
 svtools/source/contnr/fileview.cxx                         |    6 -
 svtools/source/control/roadmap.cxx                         |   14 ---
 svtools/source/dialogs/wizardmachine.cxx                   |    2 
 svtools/source/misc/ehdl.cxx                               |    2 
 svtools/source/uno/popupwindowcontroller.cxx               |    2 
 svx/source/dialog/docrecovery.cxx                          |    6 -
 svx/source/form/datanavi.cxx                               |    8 -
 svx/source/form/fmtextcontrolshell.cxx                     |    6 -
 svx/source/unodraw/recoveryui.cxx                          |    4 
 sw/source/ui/dbui/addresslistdialog.cxx                    |    6 -
 sw/source/ui/dbui/createaddresslistdialog.cxx              |    2 
 sw/source/ui/dbui/mmaddressblockpage.cxx                   |    8 -
 sw/source/ui/dbui/mmdocselectpage.cxx                      |    2 
 sw/source/ui/dbui/mmgreetingspage.cxx                      |    4 
 sw/source/ui/dbui/mmoutputpage.cxx                         |    4 
 sw/source/ui/dbui/mmoutputtypepage.cxx                     |    5 -
 sw/source/ui/dbui/selectdbtabledialog.cxx                  |    2 
 sw/source/ui/envelp/envfmt.cxx                             |    2 
 sw/source/ui/envelp/envprt.cxx                             |    2 
 sw/source/ui/envelp/labfmt.cxx                             |    2 
 sw/source/ui/envelp/labprt.cxx                             |    2 
 sw/source/ui/index/cnttab.cxx                              |   30 ++----
 sw/source/ui/index/swuiidxmrk.cxx                          |    2 
 sw/source/ui/misc/glossary.cxx                             |    4 
 sw/source/ui/misc/outline.cxx                              |    2 
 sw/source/ui/table/tautofmt.cxx                            |    6 -
 sw/source/uibase/app/docsh2.cxx                            |    2 
 sw/source/uibase/app/docst.cxx                             |    2 
 sw/source/uibase/dbui/dbmgr.cxx                            |   12 +-
 sw/source/uibase/docvw/frmsidebarwincontainer.cxx          |    2 
 sw/source/uibase/utlui/navipi.cxx                          |    3 
 uui/source/iahndl-authentication.cxx                       |   10 +-
 uui/source/iahndl-errorhandler.cxx                         |    2 
 uui/source/iahndl-filter.cxx                               |    3 
 uui/source/iahndl-locking.cxx                              |   10 +-
 uui/source/iahndl-ssl.cxx                                  |    6 -
 vcl/source/app/dbggui.cxx                                  |    4 
 vcl/source/app/help.cxx                                    |    8 -
 vcl/source/app/svapp.cxx                                   |    2 
 vcl/source/control/combobox.cxx                            |    6 +
 vcl/source/control/ilstbox.cxx                             |    7 -
 vcl/source/edit/vclmedit.cxx                               |   13 ++
 vcl/source/outdev/map.cxx                                  |    4 
 vcl/source/uipreviewer/previewer.cxx                       |    4 
 vcl/source/window/builder.cxx                              |    4 
 vcl/source/window/dockmgr.cxx                              |    7 -
 vcl/source/window/dockwin.cxx                              |    4 
 vcl/source/window/layout.cxx                               |    5 +
 vcl/source/window/menu.cxx                                 |    2 
 vcl/source/window/menubarwindow.cxx                        |    6 -
 vcl/source/window/menubarwindow.hxx                        |    4 
 vcl/source/window/toolbox.cxx                              |    5 -
 vcl/source/window/toolbox2.cxx                             |    1 
 vcl/source/window/window.cxx                               |   15 +--
 vcl/unx/generic/app/i18n_status.cxx                        |    1 
 vcl/unx/gtk/a11y/atkutil.cxx                               |    2 
 vcl/workben/svpclient.cxx                                  |    1 
 vcl/workben/vcldemo.cxx                                    |    4 
 xmlsecurity/source/dialogs/certificateviewer.cxx           |    6 -
 xmlsecurity/source/dialogs/macrosecurity.cxx               |    8 -
 145 files changed, 392 insertions(+), 399 deletions(-)

New commits:
commit 0556598b35eb6d81fdaff04520f14202660f0333
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 18 08:33:14 2015 +0200

    vclwidget: check for calling delete on subclasses of vcl::Window
    
    Change-Id: I7fb7cf919e3f46dd03a18b1cb95fa881915f9642

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 58938a2..db6136b 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -819,7 +819,7 @@ void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChange
     {
         if ( !( pWindow_->GetStatus() & BASWIN_INRESCHEDULE ) )
         {
-            delete pWindow_;
+            VclPtr<BaseWindow>(pWindow_).disposeAndClear();
         }
         else
         {
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 43967f6..62d5dae 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -494,7 +494,7 @@ void OrganizeDialog::dispose()
     if (m_pTabCtrl)
     {
         for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
-            delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) );
+            VclPtr<vcl::Window>(m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) )).disposeAndClear();
     }
     m_pTabCtrl.clear();
 
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 13217f9..8ec3293 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -230,6 +230,7 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
         && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, OTableWindow *>")
         && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, class OTableWindow *>")
         && !startsWith(pVarDecl->getType().getAsString(), "::dbp::OMultiInstanceAutoRegistration< ::dbp::OUnoAutoPilot<")
+        && !startsWith(pVarDecl->getType().getAsString(), "SwSidebarWin_iterator")
         && containsWindowSubclass(pVarDecl->getType()))
     {
         report(
@@ -399,6 +400,9 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
         }
     }
     // check dispose method to make sure we are actually disposing all of the VclPtr fields
+    /*
+       Now that we are in the debugging phase this is no longer useful, since we have to break this rule on
+       occassion to make the destruction process work cleanly.
     if (pMethodDecl && pMethodDecl->isInstance() && pMethodDecl->getBody()
         && pMethodDecl->param_size()==0
         && pMethodDecl->getNameAsString() == "dispose"
@@ -458,6 +462,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
            }
        }
     }
+    */
     return true;
 }
 
@@ -466,6 +471,14 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
     if (ignoreLocation(pCXXDeleteExpr)) {
         return true;
     }
+    const CXXRecordDecl *pPointee = pCXXDeleteExpr->getArgument()->getType()->getPointeeCXXRecordDecl();
+    if (pPointee && isDerivedFromWindow(pPointee)) {
+        report(
+            DiagnosticsEngine::Warning,
+            "calling delete on instance of vcl::Window subclass, must rather call disposeAndClear()",
+            pCXXDeleteExpr->getLocStart())
+          << pCXXDeleteExpr->getSourceRange();
+    }
     const ImplicitCastExpr* pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXDeleteExpr->getArgument());
     if (!pImplicitCastExpr) {
         return true;
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index b0640f8..4b9763b 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -253,7 +253,7 @@ IMPL_LINK_NOARG(SearchProgress, CleanUpHdl)
 
     EndDialog( RET_OK );
 
-    delete this;
+    VclPtr<SearchProgress>(this).disposeAndClear();
     return 0L;
 }
 
@@ -431,7 +431,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl)
     GetParent()->LeaveWait();
 
     EndDialog( RET_OK );
-    delete this;
+    VclPtr<TakeProgress>(this).disposeAndClear();
     return 0L;
 }
 
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 9d712d0..5bf6d6d 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1498,11 +1498,11 @@ IMPL_LINK( SvxScriptErrorDialog, ShowDialog, OUString*, pMessage )
         message = OUString( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
     }
 
-    MessageDialog* pBox = new MessageDialog(NULL, message, VCL_MESSAGE_WARNING);
+    VclPtr<MessageDialog> pBox = new MessageDialog(NULL, message, VCL_MESSAGE_WARNING);
     pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
     pBox->Execute();
 
-    delete pBox;
+    pBox.disposeAndClear();
     delete pMessage;
 
     return 0;
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 7a2334a..fe3bd19 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -437,7 +437,7 @@ IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
 
 IMPL_LINK_NOARG( SvxJavaOptionsPage, ExpertConfigHdl_Impl )
 {
-    CuiAboutConfigTabPage* m_pExpertConfigDlg = new CuiAboutConfigTabPage(this);
+    VclPtr<CuiAboutConfigTabPage> m_pExpertConfigDlg = new CuiAboutConfigTabPage(this);
     m_pExpertConfigDlg->Reset();//initialize and reset function
 
     if( RET_OK == m_pExpertConfigDlg->Execute() )
@@ -445,7 +445,7 @@ IMPL_LINK_NOARG( SvxJavaOptionsPage, ExpertConfigHdl_Impl )
         m_pExpertConfigDlg->FillItemSet();//save changes if there are any
     }
 
-    delete m_pExpertConfigDlg;
+    m_pExpertConfigDlg.disposeAndClear();
     return 0;
 }
 
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 19db7a2..fdfda8c 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -693,11 +693,11 @@ void OCopyTableWizard::dispose()
 {
     for ( ;; )
     {
-        TabPage *pPage = GetPage(0);
-        if ( pPage == NULL )
+        VclPtr<TabPage> pPage = GetPage(0);
+        if ( pPage == nullptr )
             break;
         RemovePage( pPage );
-        delete pPage;
+        pPage.disposeAndClear();
     }
 
     if ( m_bDeleteSourceColumns )
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 5a858e9..2125cbd 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -265,7 +265,7 @@ bool OJoinTableView::RemoveConnection( OTableConnection* _pConn,bool _bDelete )
                                                 Any());
     if ( _bDelete )
     {
-        delete _pConn;
+        VclPtr<OTableConnection>(_pConn).disposeAndClear();
     }
 
     return true;
@@ -326,7 +326,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
     TTableWindowData::value_type pNewTabWinData(createTableWindowData( _rComposedName, rWinName,rWinName ));
 
     // insert new window in window list
-    OTableWindow* pNewTabWin = createWindow( pNewTabWinData );
+    VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
     if ( pNewTabWin->Init() )
     {
         m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
@@ -348,7 +348,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
     else
     {
         pNewTabWin->clearListBox();
-        delete pNewTabWin;
+        pNewTabWin.disposeAndClear();
     }
 }
 
@@ -398,7 +398,7 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
             m_pLastFocusTabWin = NULL;
 
         pTabWin->clearListBox();
-        delete pTabWin;
+        VclPtr<OTableWindow>(pTabWin).disposeAndClear();
 
     }
     if ( (sal_Int32)m_vTableConnection.size() < (nCount-1) ) // if some connections could be removed
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 18d0fd5..66c6e4d 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -259,7 +259,7 @@ void OQueryTableView::ReSync()
     for(;aIter != rTabWinDataList.rend();++aIter)
     {
         OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(aIter->get());
-        OTableWindow* pTabWin = createWindow(*aIter);
+        VclPtr<OTableWindow> pTabWin = createWindow(*aIter);
 
         // I dont't use ShowTabWin as this adds the window data to the list of documents.
         // This would be bad as I am getting them from there.
@@ -269,7 +269,7 @@ void OQueryTableView::ReSync()
             // The initialisation has gone wrong, this TabWin is not available, so
             // I must clean up the data and the document
             pTabWin->clearListBox();
-            delete pTabWin;
+            pTabWin.disposeAndClear();
             arrInvalidTables.push_back(pData->GetAliasName());
 
             rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
@@ -926,7 +926,7 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
             // Initialisation failed
             // (for example when the Connection to the database is not available at the moment)
             pTabWin->clearListBox();
-            delete pTabWin;
+            VclPtr<OQueryTableWindow>(pTabWin).disposeAndClear();
         }
     }
 
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 75b0c79..615a760 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -106,14 +106,14 @@ void ORelationTableView::ReSync()
     for(;aIter != rTabWinDataList.rend();++aIter)
     {
         TTableWindowData::value_type pData = *aIter;
-        OTableWindow* pTabWin = createWindow(pData);
+        VclPtr<OTableWindow> pTabWin = createWindow(pData);
 
         if (!pTabWin->Init())
         {
             // initialisation failed, which means this TabWin is not available, therefore,
             // it should be cleaned up, including its data in the document
             pTabWin->clearListBox();
-            delete pTabWin;
+            pTabWin.disposeAndClear();
             arrInvalidTables.push_back(pData->GetTableName());
 
             rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
@@ -300,7 +300,7 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
     pNewTabWinData->ShowAll(false);
 
     // link new window into the window list
-    OTableWindow* pNewTabWin = createWindow( pNewTabWinData );
+    VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
     if(pNewTabWin->Init())
     {
         m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
@@ -320,7 +320,7 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
     else
     {
         pNewTabWin->clearListBox();
-        delete pNewTabWin;
+        pNewTabWin.disposeAndClear();
     }
 }
 
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index bff66f6..efea154 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -923,7 +923,7 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
 void ExtensionCmdQueue::Thread::_checkForUpdates(
     const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
 {
-    UpdateDialog* pUpdateDialog;
+    VclPtr<UpdateDialog> pUpdateDialog;
     std::vector< UpdateData > vData;
 
     const SolarMutexGuard guard;
@@ -970,7 +970,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
     else
         pUpdateDialog->notifyMenubar( false, false ); // check if there updates to be notified via menu bar icon
 
-    delete pUpdateDialog;
+    pUpdateDialog.disposeAndClear();
 }
 
 
diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
index d26dad0..d823da5 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -215,11 +215,9 @@ namespace bib
             m_xToolBarRef->dispose();
 
         if ( pToolBar )
-        {
             pDatMan->SetToolbar(0);
-            pToolBar.disposeAndClear();
-        }
 
+        pToolBar.disposeAndClear();
         pGridWin.disposeAndClear();
         BibSplitWindow::dispose();
     }
diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx
index 31547c0..3699f31 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -93,9 +93,9 @@ void BibWindowContainer::dispose()
 {
     if( pChild )
     {
-        vcl::Window* pDel = GetChild();
+        VclPtr<vcl::Window> pDel = GetChild();
         pChild = NULL;          // prevents GetFocus for child while deleting!
-        delete pDel;
+        pDel.disposeAndClear();
     }
     vcl::Window::dispose();
 }
@@ -142,16 +142,16 @@ void BibBookContainer::dispose()
 
     if( pTopWin )
     {
-        vcl::Window* pDel = pTopWin;
+        VclPtr<vcl::Window> pDel = pTopWin;
         pTopWin = NULL;         // prevents GetFocus for child while deleting!
-        delete pDel;
+        pDel.disposeAndClear();
     }
 
     if( pBottomWin )
     {
-        vcl::Window* pDel = pBottomWin;
+        VclPtr<vcl::Window> pDel = pBottomWin;
         pBottomWin = NULL;      // prevents GetFocus for child while deleting!
-        delete pDel;
+        pDel.disposeAndClear();
     }
 
     CloseBibModul( pBibMod );
diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx
index d906601..3585ba3 100644
--- a/extensions/source/propctrlr/propertyeditor.cxx
+++ b/extensions/source/propctrlr/propertyeditor.cxx
@@ -81,12 +81,12 @@ namespace pcr
         for(long i = nCount-1; i >= 0; --i)
         {
             sal_uInt16 nID = m_aTabControl->GetPageId((sal_uInt16)i);
-            OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
+            VclPtr<OBrowserPage> pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
             if (pPage)
             {
                 pPage->EnableInput(false);
                 m_aTabControl->RemovePage(nID);
-                delete pPage;
+                pPage.disposeAndClear();
             }
         }
         m_aTabControl->Clear();
@@ -243,13 +243,12 @@ namespace pcr
 
     void OPropertyEditor::RemovePage(sal_uInt16 nID)
     {
-        OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
+        VclPtr<OBrowserPage> pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
 
         if (pPage)
             pPage->EnableInput(false);
         m_aTabControl->RemovePage(nID);
-        if (pPage)
-            delete pPage;
+        pPage.disposeAndClear();
     }
 
 
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index cdf2a9d..17410c2b 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -76,7 +76,7 @@ public:
     short           get_response(const vcl::Window *pWindow) const;
 
     OString         get_by_window(const vcl::Window *pWindow) const;
-    void            delete_by_window(const vcl::Window *pWindow);
+    void            delete_by_window(vcl::Window *pWindow);
 
     //release ownership of pWindow, i.e. don't delete it
     void            drop_ownership(const vcl::Window *pWindow);
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx
index 84d58ff..9cc17b7 100644
--- a/sc/source/ui/miscdlgs/retypepassdlg.cxx
+++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx
@@ -71,15 +71,15 @@ void ScRetypePassDlg::DeleteSheets()
 {
     for(auto it = maSheets.begin(); it != maSheets.end(); ++it)
     {
-        vcl::Window *pWindow = (*it);
+        VclPtr<vcl::Window> pWindow = (*it);
         vcl::Window *pChild = pWindow->GetWindow(WINDOW_FIRSTCHILD);
         while (pChild)
         {
-            vcl::Window *pOldChild = pChild;
+            VclPtr<vcl::Window> pOldChild = pChild;
             pChild = pChild->GetWindow(WINDOW_NEXT);
-            delete pOldChild;
+            pOldChild.disposeAndClear();
         }
-        delete pWindow;
+        pWindow.disposeAndClear();
     }
 }
 
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 71e9ed5..246248d 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -402,8 +402,8 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask   ,
 
     // create all internal windows and sub frames ...
     Reference< ::com::sun::star::awt::XWindow > xParentWindow = xHelpTask->getContainerWindow();
-    vcl::Window*                                     pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
-    SfxHelpWindow_Impl*                         pHelpWindow   = new SfxHelpWindow_Impl( xHelpTask, pParentWindow, WB_DOCKBORDER );
+    vcl::Window*                                pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+    VclPtr<SfxHelpWindow_Impl>                  pHelpWindow   = new SfxHelpWindow_Impl( xHelpTask, pParentWindow, WB_DOCKBORDER );
     Reference< ::com::sun::star::awt::XWindow > xHelpWindow   = VCLUnoHelper::GetInterface( pHelpWindow );
 
     Reference< XFrame > xHelpContent;
@@ -429,7 +429,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask   ,
 
     if (!xHelpContent.is())
     {
-        delete pHelpWindow;
+        pHelpWindow.disposeAndClear();
         return NULL;
     }
 
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index f8fecff..ad20376 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -276,7 +276,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
     Size        aWinSize = GetOutputSizePixel();
     size_t      nItemCount = mFilteredItemList.size();
     WinBits     nStyle = GetStyle();
-    ScrollBar*  pDelScrBar = NULL;
+    VclPtr<ScrollBar>  pDelScrBar;
 
     // consider the scrolling
     if ( nStyle & WB_VSCROLL )
@@ -441,7 +441,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
     }
 
     // delete ScrollBar
-    delete pDelScrBar;
+    pDelScrBar.disposeAndClear();
 }
 
 size_t ThumbnailView::ImplGetItem( const Point& rPos ) const
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index b7b9f73..88377b3 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -286,6 +286,7 @@ void SfxInfoBarContainerWindow::removeInfoBar(SfxInfoBarWindow* pInfoBar)
             break;
         }
     }
+    pInfoBar->disposeOnce();
 
     long nY = 0;
     for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 84a3a1c..fa3d548 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -471,7 +471,7 @@ void SfxDocTplService_Impl::init_Impl()
             aGuard.clear();
             SolarMutexClearableGuard aSolarGuard;
 
-            WaitWindow_Impl* pWin = new WaitWindow_Impl();
+            VclPtr<WaitWindow_Impl> pWin = new WaitWindow_Impl();
 
             aSolarGuard.clear();
             ::osl::ClearableMutexGuard anotherGuard( maMutex );
@@ -481,7 +481,7 @@ void SfxDocTplService_Impl::init_Impl()
             anotherGuard.clear();
             SolarMutexGuard aSecondSolarGuard;
 
-            delete pWin;
+            pWin.disposeAndClear();
         }
         else if ( needsUpdate() )
             // the UI should be shown only on the first update
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index c849ac7..09ed6b2 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1384,7 +1384,7 @@ void SfxPopupWindow::Delete()
 {
     if ( m_aDeleteLink.IsSet() )
         m_aDeleteLink.Call( this );
-    delete this;
+    VclPtr<SfxPopupWindow>(this).disposeAndClear();
 }
 
 
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 4b6e56d..739ce7d 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -820,7 +820,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                 nDialogRet = 0;
 
                 // execute PrinterSetupDialog
-                PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
+                VclPtr<PrinterSetupDialog> pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
                 SfxDialogExecutor_Impl* pExecutor = 0;
 
                 if (pImp->m_bHasPrintOptions && HasPrintOptionsPage())
@@ -847,7 +847,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                     }
                 }
 
-                DELETEZ( pPrintSetupDlg );
+                pPrintSetupDlg.disposeAndClear();
                 delete pExecutor;
 
                 // no recording of PrinterSetup except printer name (is printer dependent)
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 0bb93b4..bf77a54 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -547,7 +547,7 @@ IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu )
 
     if (pActiveListBox)
     {
-        std::unique_ptr<SmFontDialog> pFontDialog(new SmFontDialog(this, pFontListDev, bHideCheckboxes));
+        ScopedVclPtrInstance<SmFontDialog> pFontDialog(this, pFontListDev, bHideCheckboxes);
 
         pActiveListBox->WriteTo(*pFontDialog);
         if (pFontDialog->Execute() == RET_OK)
@@ -1504,7 +1504,7 @@ IMPL_LINK_NOARG( SmSymbolDialog, SymbolChangeHdl )
 
 IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl)
 {
-    std::unique_ptr<SmSymDefineDialog> pDialog(new SmSymDefineDialog(this, pFontListDev, rSymbolMgr));
+    ScopedVclPtrInstance<SmSymDefineDialog> pDialog(this, pFontListDev, rSymbolMgr);
 
     // set current symbol and SymbolSet for the new dialog
     const OUString  aSymSetName (m_pSymbolSets->GetSelectEntry()),
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index ef2e2da..41f5212 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1589,11 +1589,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
 SvtFileView_Impl::~SvtFileView_Impl()
 {
     Clear();
-
-    // use temp pointer to prevent access of deleted member (GetFocus())
-    ViewTabListBox_Impl* pTemp = mpView;
-    mpView = NULL;
-    delete pTemp;
+    mpView.disposeAndClear();
 }
 
 
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 47e8178..9809442 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -214,7 +214,7 @@ namespace svt
         m_pHelp.disposeAndClear();
 
         for (WizardState i=0; i<m_pImpl->nFirstUnknownPage; ++i)
-            delete GetPage(i);
+            VclPtr<vcl::Window>(GetPage(i)).disposeAndClear();
 
         delete m_pImpl;
         WizardDialog::dispose();
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index d308d53..7bcd32b 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -126,7 +126,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve
 IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window*, pWindow )
 {
     (void)*pThis;
-    delete pWindow;
+    VclPtr<vcl::Window>(pWindow).disposeAndClear();
     return 0;
 }
 
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index a24f04d..a6f13b8 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1698,7 +1698,7 @@ namespace svxform
             else if (sIdent == "instancesremove")
             {
                 sal_uInt16 nId = 0;
-                XFormsPage* pPage = GetCurrentPage( nId );
+                VclPtr<XFormsPage> pPage = GetCurrentPage( nId );
                 if ( pPage )
                 {
                     OUString sInstName = pPage->GetInstanceName();
@@ -1718,7 +1718,7 @@ namespace svxform
                             if ( aFoundPage != aPageListEnd )
                             {
                                 m_aPageList.erase( aFoundPage );
-                                delete pPage;
+                                pPage.disposeAndClear() ;
                                 bDoRemove = true;
                             }
                         }
@@ -2010,10 +2010,10 @@ namespace svxform
         sal_Int32 i, nCount = m_aPageList.size();
         for ( i = 0; i < nCount; ++i )
         {
-            XFormsPage* pPage = m_aPageList[i];
+            VclPtr<XFormsPage> pPage = m_aPageList[i];
             pPage->ClearModel();
             if ( bClearPages )
-                delete pPage;
+                pPage.disposeAndClear();
         }
 
         if ( bClearPages )
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
index 000d619..f486d75 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -411,7 +411,8 @@ IMPL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer )
             (!pThis->m_pImpl->xMailDispatcher.is() ||
                     !pThis->m_pImpl->xMailDispatcher->isRunning()))
     {
-        delete pThis;
+        VclPtr<vcl::Window> a(pThis);
+        a.disposeAndClear();
     }
     else
     {
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 456a151..073fc00 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1625,13 +1625,8 @@ public:
         m_pParent(pTokenWin)
     {
     }
-<<<<<<< HEAD
-    virtual ~SwTOXButton() { dispose(); }
-    virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); }
-=======
     virtual ~SwTOXButton() { disposeOnce(); }
-    virtual void dispose() SAL_OVERRIDE { m_pParent.disposeAndClear(); PushButton::dispose(); }
->>>>>>> 82c89a6... vclwidget: only call dispose() once
+    virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); }
 
     virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
@@ -2772,9 +2767,10 @@ void SwTokenWindow::dispose()
 {
     for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
     {
-        it->SetGetFocusHdl( Link() );
-        it->SetLoseFocusHdl( Link() );
-        it->disposeAndClear();
+        VclPtr<Control> pControl = (*it);
+        pControl->SetGetFocusHdl( Link() );
+        pControl->SetLoseFocusHdl( Link() );
+        pControl.disposeAndClear();
     }
     aControlList.clear();
     disposeBuilder();
@@ -3192,15 +3188,15 @@ void SwTokenWindow::RemoveControl(SwTOXButton* pDel, bool bInternalCall )
     ctrl_iterator itLeft = it, itRight = it;
     --itLeft;
     ++itRight;
-    Control *pLeftEdit = *itLeft;
-    Control *pRightEdit = *itRight;
+    VclPtr<Control> pLeftEdit = *itLeft;
+    VclPtr<Control> pRightEdit = *itRight;
 
-    static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() +
-                                     static_cast<SwTOXEdit*>(pRightEdit)->GetText());
-    static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize();
+    static_cast<SwTOXEdit*>(pLeftEdit.get())->SetText(static_cast<SwTOXEdit*>(pLeftEdit.get())->GetText() +
+                                     static_cast<SwTOXEdit*>(pRightEdit.get())->GetText());
+    static_cast<SwTOXEdit*>(pLeftEdit.get())->AdjustSize();
 
     aControlList.erase(itRight);
-    delete pRightEdit;
+    pRightEdit.disposeAndClear();
 
     aControlList.erase(it);
     pActiveCtrl->Hide();
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 45230c1..f8ef22b 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -943,7 +943,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             bool bPageStylesWithHeaderFooter = false;
 
             vcl::Window *pSourceWindow = 0;
-            CancelableDialog *pProgressDlg = 0;
+            VclPtr<CancelableModelessDialog> pProgressDlg;
 
             if (!IsMergeSilent()) {
                 pSourceWindow = &pSourceShell->GetView().GetEditWin();
@@ -953,7 +953,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                     pProgressDlg = new CreateMonitor( pParent, pParent != pSourceWindow );
                 else {
                     pProgressDlg = new PrintMonitor( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT );
-                    static_cast<PrintMonitor*>( pProgressDlg )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
+                    static_cast<PrintMonitor*>( pProgressDlg.get() )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
                 }
                 pProgressDlg->SetCancelHdl( LINK(this, SwDBManager, PrtCancelHdl) );
                 pProgressDlg->Show();
@@ -1028,7 +1028,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             int targetDocPageCount = 0;
             if( !IsMergeSilent() && bMergeShell &&
                     lcl_getCountFromResultSet( nDocCount, pImpl->pMergeData->xResultSet ) )
-                static_cast<CreateMonitor*>( pProgressDlg )->SetTotalCount( nDocCount );
+                static_cast<CreateMonitor*>( pProgressDlg.get() )->SetTotalCount( nDocCount );
 
             long nStartRow, nEndRow;
             bool bFreezedLayouts = false;
@@ -1092,9 +1092,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                             aTempFileURL.reset( new INetURLObject(aTempFile->GetURL()));
                         if (!IsMergeSilent()) {
                             if( bMergeShell )
-                                static_cast<CreateMonitor*>( pProgressDlg )->SetCurrentPosition( nDocNo );
+                                static_cast<CreateMonitor*>( pProgressDlg.get() )->SetCurrentPosition( nDocNo );
                             else {
-                                PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg );
+                                PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg.get() );
                                 pPrintMonDlg->m_pPrinter->SetText( createTempFile ? aTempFileURL->GetBase() : OUString( pSourceDocSh->GetTitle( 22 )));
                                 OUString sStat(SW_RES(STR_STATSTR_LETTER));   // Brief
                                 sStat += " ";
@@ -1409,7 +1409,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));
             }
 
-            DELETEZ( pProgressDlg );
+            pProgressDlg.disposeAndClear();
 
             // save the single output document
             if (bMergeShell)
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 1032b7f..f5161a7 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -859,7 +859,8 @@ void SwNavigationPI::dispose()
     SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD());
     pImgMan->ReleaseToolBox(aContentToolBox.get());
     pImgMan->ReleaseToolBox(aGlobalToolBox.get());
-    delete aContentToolBox->GetItemWindow(FN_PAGENUMBER);
+    VclPtr<vcl::Window> a(aContentToolBox->GetItemWindow(FN_PAGENUMBER));
+    a.disposeAndClear();
     aContentToolBox->Clear();
     if(pxObjectShell)
     {
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 50151ac..c13acfa 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -229,12 +229,12 @@ void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rS
 
 void Help::HideTip( sal_uLong nId )
 {
-    HelpTextWindow* pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
+    VclPtr<HelpTextWindow> pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
     vcl::Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
     pHelpWin->Hide();
     // trigger update, so that a Paint is instantly triggered since we do not save the background
     pFrameWindow->ImplUpdateAll();
-    delete pHelpWin;
+    pHelpWin.disposeAndClear();
     ImplGetSVData()->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
 }
 
@@ -550,7 +550,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, sal_uIn
 void ImplDestroyHelpWindow( bool bUpdateHideTime )
 {
     ImplSVData* pSVData = ImplGetSVData();
-    HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+    VclPtr<HelpTextWindow> pHelpWin = pSVData->maHelpData.mpHelpWin;
     if ( pHelpWin )
     {
         vcl::Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
@@ -561,7 +561,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
         pSVData->maHelpData.mpHelpWin = NULL;
         pSVData->maHelpData.mbKeyboardHelp = false;
         pHelpWin->Hide();
-        delete pHelpWin;
+        pHelpWin.disposeAndClear();
         if( bUpdateHideTime )
             pSVData->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
     }
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index b359e50..a1aa6c1 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -232,9 +232,9 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
                     vcl::Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame );
                 else
                 {
-                    WorkWindow* pWin = new WorkWindow( NULL, 0 );
+                    VclPtr<WorkWindow> pWin = new WorkWindow( NULL, 0 );
                     vcl::Window::ImplInitAppFontData( pWin );
-                    delete pWin;
+                    pWin.disposeAndClear();
                 }
             }
             rMapRes.mnMapScNumX   = pSVData->maGDIData.mnAppFontX;
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index e889e78..2007429 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -68,7 +68,7 @@ int UIPreviewApp::Main()
 
     try
     {
-        Dialog *pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
+        VclPtr<Dialog> pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
 
         {
             VclBuilder aBuilder(pDialog, OUString(), uifiles[0]);
@@ -90,7 +90,7 @@ int UIPreviewApp::Main()
             pRealDialog->Execute();
         }
 
-        delete pDialog;
+        pDialog.disposeAndClear();
     }
     catch (const uno::Exception &e)
     {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 275e075..92595d0 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3292,10 +3292,10 @@ void VclBuilder::delete_by_name(const OString& sID)
     }
 }
 
-void VclBuilder::delete_by_window(const vcl::Window *pWindow)
+void VclBuilder::delete_by_window(vcl::Window *pWindow)
 {
     drop_ownership(pWindow);
-    delete pWindow;
+    VclPtr<vcl::Window>(pWindow).disposeAndClear();
 }
 
 void VclBuilder::drop_ownership(const vcl::Window *pWindow)
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 2010fd9..c5726af 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -856,14 +856,14 @@ bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos )
     mbStartFloat    = mbLastFloatMode;
 
     // calculate FloatingBorder
-    FloatingWindow* pWin;
+    VclPtr<FloatingWindow> pWin;
     if ( mpFloatWin )
         pWin = mpFloatWin;
     else
         pWin = new ImplDockFloatWin2( mpParent, mnFloatBits, NULL );
     pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
     if ( !mpFloatWin )
-        delete pWin;
+        pWin.disposeAndClear();
 
     Point   aPos    = GetWindow()->ImplOutputToFrame( Point() );
     Size    aSize   = GetWindow()->GetOutputSizePixel();
@@ -1299,8 +1299,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
                 GetWindow()->SetParent( pRealParent );
                 GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
 
-                delete static_cast<ImplDockFloatWin2*>(mpFloatWin.get());
-                mpFloatWin = NULL;
+                mpFloatWin.disposeAndClear();
                 GetWindow()->SetPosPixel( maDockPos );
 
                 if ( bVisible )
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 6ceafc2..6cc6301 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -264,14 +264,14 @@ bool DockingWindow::ImplStartDocking( const Point& rPos )
     mbStartFloat    = mbLastFloatMode;
 
     // calculate FloatingBorder
-    FloatingWindow* pWin;
+    VclPtr<FloatingWindow> pWin;
     if ( mpFloatWin )
         pWin = mpFloatWin;
     else
         pWin = new ImplDockFloatWin( mpImplData->mpParent, mnFloatBits, NULL );
     pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
     if ( !mpFloatWin )
-        delete pWin;
+        pWin.disposeAndClear();
 
     Point   aPos    = ImplOutputToFrame( Point() );
     Size    aSize   = Window::GetOutputSizePixel();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 61ed193..2af9470 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2097,7 +2097,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
             // this is a little awkward: some controls (e.g. svtools ProgressBar)
             // cannot avoid getting constructed with WB_BORDER but want to disable
             // borders in case of NWF drawing. So they need a method to remove their border window
-            vcl::Window* pBorderWin = mpWindowImpl->mpBorderWindow;
+            VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
             // remove us as border window's client
             pBorderWin->mpWindowImpl->mpClientWindow = NULL;
             mpWindowImpl->mpBorderWindow = NULL;
@@ -2109,7 +2109,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
             Size aBorderSize( pBorderWin->GetSizePixel() );
             setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
             // release border window
-            delete pBorderWin;
+            pBorderWin.disposeAndClear();
 
             // set new style bits
             SetStyle( GetStyle() & (~WB_BORDER) );
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 5ca8435..7a28f7b 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -66,9 +66,9 @@ CertificateViewer::~CertificateViewer()
 
 void CertificateViewer::dispose()
 {
-    delete mpTabCtrl->GetTabPage(mnGeneralId);
-    delete mpTabCtrl->GetTabPage(mnDetailsId);
-    delete mpTabCtrl->GetTabPage(mnPathId);
+    mpTabCtrl->GetTabPage(mnGeneralId)->disposeOnce();
+    mpTabCtrl->GetTabPage(mnDetailsId)->disposeOnce();
+    mpTabCtrl->GetTabPage(mnPathId)->disposeOnce();
     mpTabCtrl.clear();
     TabDialog::dispose();
 }
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 8924a49..9bf3ce1 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -89,13 +89,13 @@ MacroSecurity::~MacroSecurity()
 
 void MacroSecurity::dispose()
 {
-    delete m_pTabCtrl->GetTabPage(m_nSecTrustId);
-    delete m_pTabCtrl->GetTabPage(m_nSecLevelId);
+    m_pTabCtrl->GetTabPage(m_nSecTrustId)->disposeOnce();
+    m_pTabCtrl->GetTabPage(m_nSecLevelId)->disposeOnce();
     m_pTabCtrl.clear();
     m_pOkBtn.clear();
     m_pResetBtn.clear();
-    mpLevelTP.clear();
-    mpTrustSrcTP.clear();
+    mpLevelTP.disposeAndClear();
+    mpTrustSrcTP.disposeAndClear();
     TabDialog::dispose();
 }
 
commit 7aa921cb53eedd0a107fbe9f75365adcce4d37d9
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 20:36:34 2015 +0000

    lingering smart_ptr 'reset' -> disposeAndClear.
    
    Change-Id: Ia126588580b76cc69944bb974d93cb51ee0356dd

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index b1e2917..83603a7 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -89,11 +89,6 @@ void Deck::dispose()
         maPanels[i]->dispose();
 
     maPanels.clear();
-    mpTitleBar.disposeAndClear();
-    mpScrollClipWindow.disposeAndClear();
-    mpScrollContainer.disposeAndClear();
-    mpFiller.disposeAndClear();
-    mpVerticalScrollBar.disposeAndClear();
     vcl::Window::dispose();
 }
 
@@ -114,11 +109,11 @@ void Deck::Dispose (void)
         }
     }
 
-    mpTitleBar.reset();
-    mpFiller.reset();
-    mpVerticalScrollBar.reset();
-    mpScrollContainer.reset();
-    mpScrollClipWindow.reset();
+    mpTitleBar.disposeAndClear();
+    mpFiller.disposeAndClear();
+    mpVerticalScrollBar.disposeAndClear();
+    mpScrollContainer.disposeAndClear();
+    mpScrollClipWindow.disposeAndClear();
 }
 
 DeckTitleBar* Deck::GetTitleBar (void) const
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 086999e..2f33b95 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -77,7 +77,6 @@ Panel::~Panel()
 void Panel::dispose()
 {
     Dispose();
-    mpTitleBar.disposeAndClear();
     vcl::Window::dispose();
 }
 
@@ -98,7 +97,7 @@ void Panel::Dispose (void)
             xComponent->dispose();
     }
 
-    mpTitleBar.reset();
+    mpTitleBar.disposeAndClear();
 }
 
 PanelTitleBar* Panel::GetTitleBar (void) const
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index ab01e7d..dd66551 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -117,8 +117,7 @@ SidebarController::SidebarController (
       mxReadOnlyModeDispatch(),
       mbIsDocumentReadOnly(false),
       mpSplitWindow(NULL),
-      mnWidthOnSplitterButtonDown(0),
-      mpCloseIndicator()
+      mnWidthOnSplitterButtonDown(0)
 {
     // Listen for context change events.
     css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -173,6 +172,8 @@ SidebarController* SidebarController::GetSidebarControllerForFrame (
 
 void SAL_CALL SidebarController::disposing (void)
 {
+    mpCloseIndicator.disposeAndClear();
+
     SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
     if (iEntry != maSidebarControllerContainer.end())
         maSidebarControllerContainer.erase(iEntry);
@@ -204,10 +205,10 @@ void SAL_CALL SidebarController::disposing (void)
     {
         mpCurrentDeck->Dispose();
         mpCurrentDeck->PrintWindowTree();
-        mpCurrentDeck.reset();
+        mpCurrentDeck.disposeAndClear();
     }
 
-    mpTabBar.reset();
+    mpTabBar.disposeAndClear();
 
     Theme::GetPropertySet()->removePropertyChangeListener(
         OUString(""),
@@ -537,7 +538,7 @@ void SidebarController::SwitchToDeck (
         if (mpCurrentDeck)
         {
             mpCurrentDeck->Dispose();
-            mpCurrentDeck.reset();
+            mpCurrentDeck.disposeAndClear();
         }
 
         msCurrentDeckId = rDeckDescriptor.msId;
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 795b916..b055ec3 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -70,7 +70,6 @@ TabBar::~TabBar()
 void TabBar::dispose()
 {
     maItems.clear();
-    mpMenuButton.reset();
     mpMenuButton.disposeAndClear();
     vcl::Window::dispose();
 }
@@ -103,7 +102,7 @@ void TabBar::SetDecks (
             iItem!=iEnd;
             ++iItem)
         {
-            iItem->mpButton.reset();
+            iItem->mpButton.disposeAndClear();
         }
         maItems.clear();
     }
@@ -124,7 +123,8 @@ void TabBar::SetDecks (
 
         Item& rItem (maItems[nIndex++]);
         rItem.msDeckId = pDescriptor->msId;
-        rItem.mpButton.reset(CreateTabItem(*pDescriptor));
+        rItem.mpButton.disposeAndClear();
+        rItem.mpButton = CreateTabItem(*pDescriptor);
         rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
         rItem.maDeckActivationFunctor = maDeckActivationFunctor;
         rItem.mbIsHiddenByDefault = false;
commit 256371f49dad16347db48d7ff826779345538f3c
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 20:19:40 2015 +0000

    clear() is the equivalent of assigning a local ptr to NULL.
    
    Sometimes it matters; doing a disposeAndClear() instead can change
    the order of destruction profoundly. Fix a number of issues from:
        "vclwidget: change all vcl::window fields to be wrapped in VclPtr"
    
    Change-Id: I3127d3ed973458e8299156453258e167dbdb8ccf

diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index e6c680e..baf1acf 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -202,7 +202,7 @@ MediaControl::~MediaControl()
 void MediaControl::dispose()
 {
     maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL );
-    mpZoomListBox.disposeAndClear();
+    mpZoomListBox.clear();
     maTimeEdit.disposeAndClear();
     maZoomToolBox.disposeAndClear();
     maVolumeSlider.disposeAndClear();
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index d161f50..58938a2 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -232,6 +232,12 @@ Shell::~Shell()
     SetWindow( 0 );
     SetCurWindow( 0 );
 
+    for (WindowTable::iterator it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+    {
+        // no store; does already happen when the BasicManagers are destroyed
+        it->second.disposeAndClear();
+    }
+
     // no store; does already happen when the BasicManagers are destroyed
     aWindowTable.clear();
 
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 1210b8a..a540534 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -105,9 +105,11 @@ IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl)
 IMPL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl)
 
-AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl()                                       \
+AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl()
 {
+    pDlg.disposeAndClear();
 }
+
 short AbstractSvxZoomDialog_Impl::Execute()
 {
     return pDlg->Execute();
@@ -153,6 +155,7 @@ IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl);
 // virtual
 VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl()
 {
+    m_pDlg.disposeAndClear();
 }
 
 // virtual
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index d356bba..98833f9 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -72,8 +72,9 @@ public:                                             \
 #define IMPL_ABSTDLG_BASE(Class)                    \
 Class::~Class()                                     \
 {                                                   \
+     pDlg.disposeAndClear();                        \
 }                                                   \
-short Class::Execute()                             \
+short Class::Execute()                              \
 {                                                   \
     return pDlg->Execute();                         \
 }
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 1ec9b03..e1f2ecd 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -160,7 +160,6 @@ SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
     : pParent(pParentWindow)
     , nType(nId)
     , eChildAlignment(SfxChildAlignment::NOALIGNMENT)
-    , pWindow(0L)
 {
     pImp = new SfxChildWindow_Impl;
     pImp->pFact = 0L;
@@ -199,6 +198,7 @@ void SfxChildWindow::Destroy()
 SfxChildWindow::~SfxChildWindow()
 {
     delete pContext;
+    pWindow.disposeAndClear();
     delete pImp;
 }
 
@@ -510,13 +510,13 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding
 }
 
 SfxChildWindowContext::SfxChildWindowContext( sal_uInt16 nId )
-    : pWindow( NULL )
-    , nContextId( nId )
+    : nContextId( nId )
 {
 }
 
 SfxChildWindowContext::~SfxChildWindowContext()
 {
+    pWindow.disposeAndClear();
 }
 
 FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const
commit a140e0d0bab3bd09fe19711fc99e411fcc2675d7
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 17:45:07 2015 +0000

    fix explicit delete.
    
    Change-Id: I6d12eb32e9c8fcb403473c41b3a6eb2f29fe8639

diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index e993174..c849ac7 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -274,9 +274,9 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime
 
     // Remove and destroy our item window at our toolbox
     SolarMutexGuard aGuard;
-    vcl::Window* pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
+    VclPtr< vcl::Window > pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
     pImpl->pBox->SetItemWindow( pImpl->nTbxId, 0 );
-    delete pWindow;
+    pWindow.disposeAndClear();
 
     // Dispose an open sub toolbar. It's possible that we have an open
     // sub toolbar while we get disposed. Therefore we have to dispose
commit 15178933b18bc3980890c1cd5a3f0e8ec3d5c744
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 16:58:15 2015 +0000

    fix ilistbox dispose.
    
    Change-Id: Icc5b6e924dfeec7a7da4f654d79b17fe91ce1418

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 441b3b5..2c78507 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -74,7 +74,11 @@ ComboBox::~ComboBox()
 void ComboBox::dispose()
 {
     mpSubEdit.disposeAndClear();
-    mpImplLB.disposeAndClear();
+
+    VclPtr< ImplListBox > pImplLB = mpImplLB;
+    mpImplLB.clear();
+    pImplLB.disposeAndClear();
+
     mpFloatWin.disposeAndClear();
     mpBtn.disposeAndClear();
     Edit::dispose();
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e05746e..dc09182 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2174,10 +2174,9 @@ ImplListBox::~ImplListBox()
 
 void ImplListBox::dispose()
 {
-    mpHScrollBar.clear();
-    mpVScrollBar.clear();
-    mpScrollBarBox.clear();
-    maLBWindow.clear();
+    mpHScrollBar.disposeAndClear();
+    mpVScrollBar.disposeAndClear();
+    mpScrollBarBox.disposeAndClear();
     maLBWindow.disposeAndClear();
     Control::dispose();
 }
commit 462f0ede49cf96e3da1c7d30c39b33e383aa9451
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 16:51:35 2015 +0000

    better widget debugging / printouts.
    
    Now this is in dispose, not a destructor we can use RTTI nicely.
    
    Change-Id: I6d92dce7a1c76a194a0f354a7a49a49a35c11794

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index aff72de..61ed193 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -273,8 +273,7 @@ void Window::dispose()
             {
                 OStringBuffer aTempStr;
                 aTempStr.append("Window (");
-                aTempStr.append(OUStringToOString(GetText(),
-                                                       RTL_TEXTENCODING_UTF8));
+                aTempStr.append(lcl_createWindowInfo(*this));
                 aTempStr.append(") with live SystemWindows destroyed: ");
                 aTempStr.append(aErrorStr.toString());
                 OSL_FAIL(aTempStr.getStr());
@@ -298,7 +297,7 @@ void Window::dispose()
         if ( bError )
         {
             OStringBuffer aTempStr( "Window (" );
-            aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+            aTempStr.append(lcl_createWindowInfo(*this));
             aTempStr.append(") with live SystemWindows destroyed: ");
             aTempStr.append(aErrorStr.toString());
             OSL_FAIL( aTempStr.getStr() );
@@ -308,7 +307,7 @@ void Window::dispose()
         if ( mpWindowImpl->mpFirstChild )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+            aTempStr.append(lcl_createWindowInfo(*this));
             aTempStr.append(") with live children destroyed: ");
             pTempWin = mpWindowImpl->mpFirstChild;
             while ( pTempWin )
@@ -323,7 +322,7 @@ void Window::dispose()
         if ( mpWindowImpl->mpFirstOverlap )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+            aTempStr.append(lcl_createWindowInfo(*this));
             aTempStr.append(") with live SystemWindows destroyed: ");
             pTempWin = mpWindowImpl->mpFirstOverlap;
             while ( pTempWin )
commit a6ee7434d15c69941d1d415e33a92ae8e3e49fd1
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 16:43:50 2015 +0000

    un-tangle more lifecycle issues, and improve taskpanelist debugging.
    
    Change-Id: Ic542fac901edb87418abc1d460ed4e7d9bad67c5

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 3c3256a..58ec924 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4833,7 +4833,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
     else
     {
         // create dummy toolbox for measurements
-        ToolBox *pToolBox = new ToolBox( GetParent(), GetStyle() );
+        VclPtr< ToolBox > pToolBox = new ToolBox( GetParent(), GetStyle() );
 
         // copy until first useful item
         std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin();
@@ -4861,7 +4861,8 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
 
         ImplGetDockingManager()->RemoveWindow( pToolBox );
         pToolBox->Clear();
-        delete pToolBox;
+
+        pToolBox.disposeAndClear();
 
         return aSize;
     }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 31f537c..aff72de 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -349,7 +349,7 @@ void Window::dispose()
         if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
         {
             OStringBuffer aTempStr("Window (");
-            aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+            aTempStr.append(lcl_createWindowInfo(*this));
             aTempStr.append(") still in TaskPanelList!");
             OSL_FAIL( aTempStr.getStr() );
             Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!
commit 2b1772c5b8bd4aedbc7ec7a9a916ac8c8f975f34
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Mar 17 15:37:03 2015 +0000

    add missing disposeAndClear pieces for VclMEdit
    
    Also correct dispose ordering in dbaccess.

diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index bebc01f..06c4a2a 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -252,13 +252,14 @@ void OAppDetailPageHelper::dispose()
             m_pLists[i].disposeAndClear();
         }
     }
-    m_aFL.disposeAndClear();
-    m_aTBPreview.disposeAndClear();
-    m_aPreview.disposeAndClear();
-    m_aDocumentInfo.disposeAndClear();
+    m_aMenu.reset();
     m_pTablePreview.disposeAndClear();
+    m_aDocumentInfo.disposeAndClear();
+    m_aPreview.disposeAndClear();
     m_aBorder.disposeAndClear();
-    m_aMenu.reset();
+    m_aTBPreview.disposeAndClear();
+    m_aFL.disposeAndClear();
+
     vcl::Window::dispose();
 }
 
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index f61969f..3ab9d13a 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1489,7 +1489,8 @@ SfxViewFrame::~SfxViewFrame()
         // The Bindings delete the Frame!
         KillDispatcher_Impl();
 
-    pImp->pWindow.clear();
+    pImp->pWindow.disposeAndClear();
+    pImp->pFocusWin.clear();
 
     if ( GetFrame().GetCurrentViewFrame() == this )
         GetFrame().SetCurrentViewFrame_Impl( NULL );
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index f11e404..4322248 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -255,6 +255,11 @@ void ImpVclMEdit::InitFromStyle( WinBits nWinStyle )
 ImpVclMEdit::~ImpVclMEdit()
 {
     EndListening( *mpTextWindow->GetTextEngine() );
+    mpScrollBox.disposeAndClear();
+    mpVScrollBar.disposeAndClear();
+    mpHScrollBar.disposeAndClear();
+    mpTextWindow.disposeAndClear();
+    pVclMultiLineEdit.disposeAndClear();
 }
 
 void ImpVclMEdit::ImpSetScrollBarRanges()
@@ -1153,17 +1158,17 @@ void VclMultiLineEdit::SetText( const OUString& rStr )
 
 OUString VclMultiLineEdit::GetText() const
 {
-    return pImpVclMEdit->GetText();
+    return pImpVclMEdit ? pImpVclMEdit->GetText() : OUString("");
 }
 
 OUString VclMultiLineEdit::GetText( LineEnd aSeparator ) const
 {
-    return pImpVclMEdit->GetText( aSeparator );
+    return pImpVclMEdit ? pImpVclMEdit->GetText( aSeparator ) : OUString("");
 }
 
-OUString VclMultiLineEdit::GetTextLines(  LineEnd aSeparator ) const
+OUString VclMultiLineEdit::GetTextLines( LineEnd aSeparator ) const
 {
-    return pImpVclMEdit->GetTextLines( aSeparator );
+    return pImpVclMEdit ? pImpVclMEdit->GetTextLines( aSeparator ) : OUString("");
 }
 
 void VclMultiLineEdit::Resize()
commit 6d0c89123f353aed80d3a8a08ef5cd1ffaa1eea9
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 17 15:13:34 2015 +0200

    vclwidget: fix more places that should be wrapping in VclPtr
    
    Change-Id: I31c9115662da2f81e1b22be91ee58e2862076b8e

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index e1d92e1..d161f50 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -297,7 +297,7 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
 
     bool bSetCurWindow = false;
     bool bSetCurLib = ( _rDocument == m_aCurDocument );
-    std::vector<BaseWindow*> aDeleteVec;
+    std::vector<VclPtr<BaseWindow> > aDeleteVec;
 
     // remove all windows which belong to this document
     for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
@@ -318,7 +318,7 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
         }
     }
     // delete windows outside main loop so we don't invalidate the original iterator
-    for (std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it)
+    for (auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it)
     {
         BaseWindow* pWin = *it;
         pWin->StoreData();
@@ -599,14 +599,14 @@ void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
 void Shell::CheckWindows()
 {
     bool bSetCurWindow = false;
-    std::vector<BaseWindow*> aDeleteVec;
+    std::vector<VclPtr<BaseWindow> > aDeleteVec;
     for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
     {
         BaseWindow* pWin = it->second;
         if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
             aDeleteVec.push_back( pWin );
     }
-    for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+    for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
     {
         BaseWindow* pWin = *it;
         pWin->StoreData();
@@ -623,14 +623,14 @@ void Shell::CheckWindows()
 void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLibName, bool bDestroy )
 {
     bool bChangeCurWindow = pCurWin ? false : true;
-    std::vector<BaseWindow*> aDeleteVec;
+    std::vector<VclPtr<BaseWindow> > aDeleteVec;
     for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
     {
         BaseWindow* pWin = it->second;
         if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
             aDeleteVec.push_back( pWin );
     }
-    for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+    for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
     {
         BaseWindow* pWin = *it;
         if ( pWin == pCurWin )
@@ -650,7 +650,7 @@ void Shell::UpdateWindows()
     bool bChangeCurWindow = pCurWin ? false : true;
     if ( !m_aCurLibName.isEmpty() )
     {
-        std::vector<BaseWindow*> aDeleteVec;
+        std::vector<VclPtr<BaseWindow> > aDeleteVec;
         for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
         {
             BaseWindow* pWin = it->second;
@@ -666,7 +666,7 @@ void Shell::UpdateWindows()
                     aDeleteVec.push_back( pWin );
             }
         }
-        for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+        for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
         {
             RemoveWindow( *it, false, false );
         }
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 6fee19e..a746060 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -242,8 +242,8 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
     OUString aScriptURL;
     SbMethod* pMethod = NULL;
 
-    boost::scoped_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
-    if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() )
+    VclPtr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
+    if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() )
         pChooser->SetMode(MacroChooser::ChooseOnly);
 
     if ( !bChooseOnly && rxLimitToDocument.is() )
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 49b155a..ce39d72 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -777,7 +777,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
         StoreMacroDescription();
 
         EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(m_pBasicBox->FirstSelected());
-        boost::scoped_ptr<OrganizeDialog> pDlg(new OrganizeDialog( this, 0, aDesc ));
+        VclPtr<OrganizeDialog> pDlg(new OrganizeDialog( this, 0, aDesc ));
         sal_uInt16 nRet = pDlg->Execute();
         pDlg.reset();
 
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 6309b88..d231fe9 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -688,7 +688,7 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
                 bool const bProtected = xPasswd->isLibraryPasswordProtected( aLibName );
 
                 // change password dialog
-                boost::scoped_ptr<SvxPasswordDialog> pDlg(new SvxPasswordDialog( this, true, !bProtected ));
+                VclPtr<SvxPasswordDialog> pDlg(new SvxPasswordDialog( this, true, !bProtected ));
                 pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) );
 
                 if ( pDlg->Execute() == RET_OK )
@@ -826,7 +826,7 @@ void LibPage::InsertLib()
 
         if ( xModLibContImport.is() || xDlgLibContImport.is() )
         {
-            boost::scoped_ptr<LibDialog> pLibDlg;
+            VclPtr<LibDialog> pLibDlg;
 
             Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY );
             Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY );
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 94d0693..eef9ae6 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -183,7 +183,7 @@ RTLFUNC(InputBox)
             nX = rPar.Get(4)->GetLong();
             nY = rPar.Get(5)->GetLong();
         }
-        boost::scoped_ptr<SvRTLInputBox> pDlg(new SvRTLInputBox(Application::GetDefDialogParent(),
+        VclPtr<SvRTLInputBox> pDlg(new SvRTLInputBox(Application::GetDefDialogParent(),
                     rPrompt,aTitle,aDefault,nX,nY));
         pDlg->Execute();
         rPar.Get(0)->PutString( pDlg->GetText() );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 623b092..19bc0bf 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4607,7 +4607,7 @@ RTLFUNC(MsgBox)
     }
 
     nType &= (16+32+64);
-    boost::scoped_ptr<MessBox> pBox;
+    VclPtr<MessBox> pBox;
 
     SolarMutexGuard aSolarGuard;
 
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index afea410..c5606f9 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -549,8 +549,8 @@ void ShapeController::executeDispatch_FontDialog()
             SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
             pDrawViewWrapper->GetAttributes( aAttr );
             ViewElementListProvider aViewElementListProvider( pDrawModelWrapper );
-            ::boost::scoped_ptr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) );
-            if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+            VclPtr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) );
+            if ( pDlg->Execute() == RET_OK )
             {
                 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
                 pDrawViewWrapper->SetAttributes( *pOutAttr );
@@ -587,8 +587,8 @@ void ShapeController::executeDispatch_ParagraphDialog()
             aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
             aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
 
-            ::boost::scoped_ptr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) );
-            if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+            VclPtr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) );
+            if ( pDlg->Execute() == RET_OK )
             {
                 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
                 pDrawViewWrapper->SetAttributes( *pOutAttr );
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 3654514..13217f9 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -215,6 +215,29 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
             pVarDecl->getLocation())
           << pVarDecl->getSourceRange();
     }
+    if (   !startsWith(pVarDecl->getType().getAsString(), "std::vector<vcl::Window *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, Size>")
+        && !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, class Size>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::vector<class Button *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::vector<Button *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::mem_fun1_t<")
+        && !startsWith(pVarDecl->getType().getAsString(), "::comphelper::mem_fun1_t<")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::pair<formula::RefButton *, formula::RefEdit *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::pair<RefButton *, RefEdit *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "std::list<SwSidebarWin *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::map<OTableWindow *, sal_Int32>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::map<class OTableWindow *, sal_Int32>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, OTableWindow *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, class OTableWindow *>")
+        && !startsWith(pVarDecl->getType().getAsString(), "::dbp::OMultiInstanceAutoRegistration< ::dbp::OUnoAutoPilot<")
+        && containsWindowSubclass(pVarDecl->getType()))
+    {
+        report(
+            DiagnosticsEngine::Warning,
+            "vcl::Window subclass should be wrapped in VclPtr. " + pVarDecl->getType().getAsString(),
+            pVarDecl->getLocation())
+          << pVarDecl->getSourceRange();
+    }
     return true;
 }
 
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 434dc20..de47eaa 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2443,7 +2443,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
         OUString aNewName( stripHotKey( pMenuData->GetName() ) );
         OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
 
-        boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+        VclPtr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
         pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU );
         pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
 
@@ -2460,7 +2460,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
     {
         SvxConfigEntry* pMenuData = GetTopLevelSelection();
 
-        boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
+        VclPtr<SvxMainMenuOrganizerDialog> pDialog(
             new SvxMainMenuOrganizerDialog( this,
                 GetSaveInData()->GetEntries(), pMenuData ));
 
@@ -2486,7 +2486,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
         OUString aNewName;
         OUString aDesc = CUI_RESSTR( RID_SVXSTR_SUBMENU_NAME );
 
-        boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+        VclPtr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
         pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU );
         pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) );
 
@@ -2523,7 +2523,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
         OUString aNewName( stripHotKey( pEntry->GetName() ) );
         OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
 
-        boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+        VclPtr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
         pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM );
         pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
 
@@ -2563,7 +2563,7 @@ IMPL_LINK( SvxMenuConfigPage, NewMenuHdl, Button *, pButton )
 {
     (void)pButton;
 
-    boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
+    VclPtr<SvxMainMenuOrganizerDialog> pDialog(
         new SvxMainMenuOrganizerDialog( 0,
             GetSaveInData()->GetEntries(), NULL, true ));
 
@@ -3103,7 +3103,7 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
             OUString aNewName( stripHotKey( pToolbar->GetName() ) );
             OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
 
-            boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+            VclPtr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
             pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR );
             pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
 
@@ -3189,7 +3189,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
             OUString aNewName( stripHotKey( pEntry->GetName() ) );
             OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
 
-            boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+            VclPtr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
             pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM );
             pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
 
@@ -3319,7 +3319,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
                 }
             }
 
-            boost::scoped_ptr<SvxIconSelectorDialog> pIconDialog(
+            VclPtr<SvxIconSelectorDialog> pIconDialog(
                 new SvxIconSelectorDialog( 0,
                     GetSaveInData()->GetImageManager(),
                     GetSaveInData()->GetParentImageManager() ));
@@ -4447,7 +4447,7 @@ IMPL_LINK( SvxToolbarConfigPage, NewToolbarHdl, Button *, pButton )
     OUString aNewURL =
         generateCustomURL( GetSaveInData()->GetEntries() );
 
-    boost::scoped_ptr<SvxNewToolbarDialog> pNameDialog(new SvxNewToolbarDialog( 0, aNewName ));
+    VclPtr<SvxNewToolbarDialog> pNameDialog(new SvxNewToolbarDialog( 0, aNewName ));
 
     sal_uInt16 nInsertPos;
     for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 76b3c8a..0dc55db 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -658,7 +658,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
                 )
             )
     {
-        boost::scoped_ptr<AssignComponentDialog> pAssignDlg(new AssignComponentDialog( pThis, sEventURL ));
+        VclPtr<AssignComponentDialog> pAssignDlg(new AssignComponentDialog( pThis, sEventURL ));
 
         short ret = pAssignDlg->Execute();
         if( ret )
@@ -672,7 +672,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
     else if( bAssEnabled )
     {
         // assign pressed
-        boost::scoped_ptr<SvxScriptSelectorDialog> pDlg(new SvxScriptSelectorDialog( pThis, false, pThis->GetFrame() ));
+        VclPtr<SvxScriptSelectorDialog> pDlg(new SvxScriptSelectorDialog( pThis, false, pThis->GetFrame() ));
         if( pDlg )
         {
             short ret = pDlg->Execute();
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index b960bc1..eba3a2a 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -523,7 +523,7 @@ void SpellDialog::StartSpellOptDlg_Impl()
     };
     SfxItemSet aSet( SfxGetpApp()->GetPool(), aSpellInfos);
     aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
-    boost::scoped_ptr<SfxSingleTabDialog> pDlg(
+    VclPtr<SfxSingleTabDialog> pDlg(
         new SfxSingleTabDialog(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
     SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg->get_content_area(), &aSet );
     static_cast<SvxLinguTabPage*>(pPage)->HideGroups( GROUP_MODULES );
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 0d01e90..9d712d0 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -906,7 +906,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
             }
         }
 
-        boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
+        VclPtr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
         xNewDlg->SetObjectName( aNewName );
 
         do
@@ -1029,7 +1029,7 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry )
         }
         sal_uInt16 nMode = INPUTMODE_RENAME;
 
-        boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
+        VclPtr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
         xNewDlg->SetObjectName( aNewName );
 
         bool bValid;
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index eb24820..2d179a3 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -28,7 +28,7 @@ extern "C"
 SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(vcl::Window* i_pParent, const vcl::Font& i_rFont, OUString& o_rResult)
 {
     bool bRet = false;
-    boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( i_pParent ));
+    VclPtr<SvxCharacterMap> aDlg(new SvxCharacterMap( i_pParent ));
     aDlg->DisableFontSelection();
     aDlg->SetCharFont(i_rFont);
     if ( aDlg->Execute() == RET_OK )
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 49bf4d5..afb5fe1 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -731,8 +731,8 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
     if( nSelEntryPos == REPLACE_BULLETS ||
         nSelEntryPos == APPLY_NUMBERING)
     {
-        boost::scoped_ptr<SvxCharacterMap> pMapDlg(new SvxCharacterMap(this));
-        ImpUserData* pUserData = static_cast<ImpUserData*>(m_pCheckLB->FirstSelected()->GetUserData());
+        VclPtr<SvxCharacterMap> pMapDlg(new SvxCharacterMap(this));
+        ImpUserData* pUserData = (ImpUserData*)m_pCheckLB->FirstSelected()->GetUserData();
         pMapDlg->SetCharFont(*pUserData->pFont);
         pMapDlg->SetChar( (*pUserData->pString)[0] );
         if(RET_OK == pMapDlg->Execute())
@@ -2061,7 +2061,7 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
     else if (pBtn == m_pDblEndQuotePB)
         nMode = DBL_END;
     // start character selection dialog
-    boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
+    VclPtr<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 );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 7e86557..16f0038 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3446,7 +3446,7 @@ void SvxCharTwoLinesPage::Initialize()
 void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
 {
     bool bStart = pBox == m_pStartBracketLB;
-    boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( this ));
+    VclPtr<SvxCharacterMap> aDlg(new SvxCharacterMap( this ));
     aDlg->DisableFontSelection();
 
     if ( aDlg->Execute() == RET_OK )
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 640ba9c..df53527 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2095,7 +2095,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
 
 IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
 {
-    boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
+    VclPtr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
 
     sal_uInt16 nMask = 1;
     const vcl::Font* pFmtFont = 0;
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 5fb5b01..736b872 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -446,7 +446,7 @@ long SvxBitmapTabPage::CheckChanges_Impl()
         {
             ResMgr& rMgr = CUI_MGR();
             Image aWarningBoxImage = WarningBox::GetStandardImage();
-            boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
+            VclPtr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
                                                         SVX_RES( RID_SVXSTR_BITMAP ),
                                                         CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ),
                                                         &aWarningBoxImage  ));
@@ -510,7 +510,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
     DBG_ASSERT(pFact, "Dialog creation failed!");
     boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
     DBG_ASSERT(pDlg, "Dialog creation failed!");
-    boost::scoped_ptr<MessageDialog> pWarnBox;
+    VclPtr<MessageDialog> pWarnBox;
     sal_uInt16         nError(1);
 
     while( pDlg->Execute() == RET_OK )
@@ -610,7 +610,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
         if( !nError )
         {
             OUString aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) );
-            boost::scoped_ptr<MessageDialog> pWarnBox;
+            VclPtr<MessageDialog> pWarnBox;
 
             // convert file URL to UI name
             OUString        aName;
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 4b83e77..f0e6989 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -539,7 +539,7 @@ long SvxColorTabPage::CheckChanges_Impl()
         {
             ResMgr& rMgr = CUI_MGR();
             Image aWarningBoxImage = WarningBox::GetStandardImage();
-            boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
+            VclPtr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
                                                         SVX_RESSTR( RID_SVXSTR_COLOR ),
                                                         ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ),
                                                         &aWarningBoxImage ));
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 064c023..6181de3 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -291,7 +291,7 @@ long SvxGradientTabPage::CheckChanges_Impl()
         {
             ResMgr& rMgr = CUI_MGR();
             Image aWarningBoxImage = WarningBox::GetStandardImage();
-            boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
+            VclPtr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
                                                         SVX_RESSTR( RID_SVXSTR_GRADIENT ),
                                                         CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ),
                                                         &aWarningBoxImage ));
@@ -457,7 +457,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl)
     DBG_ASSERT(pFact, "Dialog creation failed!");
     boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
     DBG_ASSERT(pDlg, "Dialog creation failed!");
-    boost::scoped_ptr<MessageDialog> pWarnBox;
+    VclPtr<MessageDialog> pWarnBox;
     sal_uInt16         nError   = 1;
 
     while( pDlg->Execute() == RET_OK )
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 1a2f42b..e98a0fa 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -261,7 +261,7 @@ long SvxHatchTabPage::CheckChanges_Impl()
     {
         ResMgr& rMgr = CUI_MGR();
         Image aWarningBoxImage = WarningBox::GetStandardImage();
-        boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
+        VclPtr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
                                                         SVX_RESSTR( RID_SVXSTR_HATCH ),
                                                         CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ),
                                                         &aWarningBoxImage ));
@@ -500,7 +500,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl)
     DBG_ASSERT(pFact, "Dialog creation failed!");
     boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
     DBG_ASSERT(pDlg, "Dialog creation failed!");
-    boost::scoped_ptr<MessageDialog> pWarnBox;
+    VclPtr<MessageDialog> pWarnBox;
     sal_uInt16         nError   = 1;
 
     while( pDlg->Execute() == RET_OK )
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index df5c921..82cf99b 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -246,7 +246,7 @@ void SvxLineDefTabPage::CheckChanges_Impl()
     {
         ResMgr& rMgr = CUI_MGR();
         Image aWarningBoxImage = WarningBox::GetStandardImage();
-        boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
+        VclPtr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
                                                     SVX_RESSTR( RID_SVXSTR_LINESTYLE ),
                                                     OUString( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
                                                     &aWarningBoxImage ));
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 84d51f9..8d5ae4c 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -309,9 +309,7 @@ OApplicationController::~OApplicationController()
         osl_atomic_increment( &m_refCount );
         dispose();
     }
-    ::std::unique_ptr< vcl::Window> aTemp( getView() );
     clearView();
-
 }
 
 IMPLEMENT_FORWARD_XTYPEPROVIDER2(OApplicationController,OApplicationController_CBASE,OApplicationController_Base)
@@ -447,7 +445,6 @@ bool OApplicationController::Construct(vcl::Window* _pParent)
 
     if ( !bSuccess )
     {
-        ::std::unique_ptr< vcl::Window> aTemp( getView() );
         clearView();
         return false;
     }
@@ -2048,7 +2045,7 @@ void OApplicationController::renameEntry()
         if ( xContainer.is() )
         {
             ::std::unique_ptr< IObjectNameCheck > pNameChecker;
-            ::std::unique_ptr< OSaveAsDlg > aDialog;
+            VclPtr< OSaveAsDlg > aDialog;
 
             Reference<XRename> xRename;
             const ElementType eType = getContainer()->getElementType();
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index d347023..f6b9127 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -55,7 +55,6 @@ void OTitleWindow::dispose()
     if ( m_pChild )
     {
         m_pChild->Hide();
-        boost::scoped_ptr<vcl::Window> aTemp(m_pChild);
     }
     m_pChild.clear();
     m_aSpace1.disposeAndClear();
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 64522f2..4080220 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -312,7 +312,6 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
     catch(Exception&)
     {
         // no one clears my view if I won't
-        boost::scoped_ptr<vcl::Window> aTemp(m_pView);
         m_pView = NULL;
         throw;
     }
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 0211012..a83aef2 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -164,17 +164,8 @@ OFieldDescControl::~OFieldDescControl()
 
 void OFieldDescControl::dispose()
 {
-    {
-        boost::scoped_ptr<vcl::Window> aTemp(m_pVertScroll);
-        m_pVertScroll    = NULL;
-    }
-    {
-        boost::scoped_ptr<vcl::Window> aTemp(m_pHorzScroll);
-        m_pHorzScroll    = NULL;
-    }
     if ( m_bAdded )
         ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-    pLastFocusWindow = NULL;
 
     // Destroy children
     DeactivateAggregate( tpDefault );
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 9aab0ce..c5a3cad 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -170,10 +170,7 @@ OJoinDesignView* OJoinController::getJoinView()
 
 void OJoinController::disposing()
 {
-    {
-        boost::scoped_ptr< vcl::Window > pEnsureDelete( m_pAddTableDialog );
-        m_pAddTableDialog   = NULL;
-    }
+    m_pAddTableDialog   = NULL;
 
     OJoinController_BASE::disposing();
 
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index ca539c8..5a858e9 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1530,7 +1530,6 @@ void OJoinTableView::clearLayoutInformation()
     {
         if ( aIter->second )
             aIter->second->clearListBox();
-        boost::scoped_ptr<vcl::Window> aTemp(aIter->second);
         aIter->second = NULL;
     }
 
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index cdc16fd..101a9ab 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -42,14 +42,6 @@ OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryContro
 
 OQueryViewSwitch::~OQueryViewSwitch()
 {
-    {
-        boost::scoped_ptr<vcl::Window> aTemp(m_pTextView);
-        m_pTextView = NULL;
-    }
-    {
-        boost::scoped_ptr<vcl::Window> aTemp(m_pDesignView);
-        m_pDesignView = NULL;
-    }
 }
 
 void OQueryViewSwitch::Construct()
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index a075891..bff66f6 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -571,7 +571,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
             text = ::comphelper::anyToString( rStatus ); // fallback
 
         const SolarMutexGuard aGuard;
-        const boost::scoped_ptr<MessageDialog> aBox(new MessageDialog(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, text));
+        VclPtr<MessageDialog> aBox(new MessageDialog(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, text));
         aBox->Execute();
     }
     ++m_nCurrentProgress;
@@ -813,7 +813,7 @@ void ExtensionCmdQueue::Thread::execute()
                     msg = ::comphelper::anyToString(exc);
 
                 const SolarMutexGuard guard;
-                boost::scoped_ptr<MessageDialog> box(
+                VclPtr<MessageDialog> box(
                     new MessageDialog(currentCmdEnv->activeDialog(), msg));
                 if ( m_pDialogHelper )
                     box->SetText( m_pDialogHelper->getWindow()->GetText() );
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 45839a4..badb58f 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -223,7 +223,7 @@ void ServiceImpl::startExecuteModal(
         catch (const Exception & exc) {
             if (bAppUp) {
                 const SolarMutexGuard guard;
-                boost::scoped_ptr<MessageDialog> box(
+                VclPtr<MessageDialog> box(
                     new MessageDialog(Application::GetActiveTopWindow(),
                                       exc.Message));
                 box->Execute();
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index c971419..2054b44 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -329,7 +329,7 @@ sal_Int16 LicenseDialog::execute() throw (RuntimeException, std::exception)
 
 sal_Int16 LicenseDialog::solar_execute()
 {
-    std::unique_ptr<LicenseDialogImpl> dlg(
+    VclPtr<LicenseDialogImpl> dlg(
         new LicenseDialogImpl(
             VCLUnoHelper::GetWindow(m_parent),
             m_xComponentContext, m_sExtensionName, m_sLicenseText));
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index b72083c..285d20e 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -1484,7 +1484,7 @@ void BibDataManager::RemoveMeAsUidListener()
 
 void BibDataManager::CreateMappingDialog(vcl::Window* pParent)
 {
-    boost::scoped_ptr<MappingDialog_Impl> pDlg(new MappingDialog_Impl(pParent, this));
+    VclPtr<MappingDialog_Impl> pDlg(new MappingDialog_Impl(pParent, this));
     if(RET_OK == pDlg->Execute() && pBibView)
     {
         reload();
@@ -1494,7 +1494,7 @@ void BibDataManager::CreateMappingDialog(vcl::Window* pParent)
 OUString BibDataManager::CreateDBChangeDialog(vcl::Window* pParent)
 {
     OUString uRet;
-    boost::scoped_ptr<DBChangeDialog_Impl> pDlg(new DBChangeDialog_Impl(pParent, this ));
+    VclPtr<DBChangeDialog_Impl> pDlg(new DBChangeDialog_Impl(pParent, this ));
     if(RET_OK == pDlg->Execute())
     {
         OUString sNewURL = pDlg->GetCurrentURL();
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index a7006cb..70fa619 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2722,7 +2722,7 @@ namespace pcr
             aCoreSet.Put( aFormatter );
 
             // a tab dialog with a single page
-            boost::scoped_ptr< SfxSingleTabDialog > xDialog(new SfxSingleTabDialog(
+            VclPtr< SfxSingleTabDialog > xDialog(new SfxSingleTabDialog(
                 impl_getDefaultDialogParent_nothrow(), aCoreSet,
                 "FormatNumberDialog", "cui/ui/formatnumberdialog.ui"));
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
index 1c78e8a..be924e6 100644
--- a/reportdesign/source/ui/dlg/Formula.cxx
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -96,9 +96,6 @@ void FormulaDialog::dispose()
     {
         SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) );
         aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US));
-
-        boost::scoped_ptr<vcl::Window> aTemp2(m_pAddField);
-        m_pAddField = NULL;
     }
 
     StoreFormEditData( m_pFormulaData );
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 9829649..1cc4d1b 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -139,28 +139,18 @@ void ODesignView::dispose()
     if ( m_pPropWin )
     {
         notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-        ::std::unique_ptr<vcl::Window> aTemp2(m_pPropWin);
-        m_pPropWin = NULL;
     }
     if ( m_pAddField )
     {
         SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) );
         aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
         notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-        ::std::unique_ptr<vcl::Window> aTemp2(m_pAddField);
-        m_pAddField = NULL;
     }
     if ( m_pReportExplorer )
     {
         SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8));
         aDlgOpt.SetWindowState(OStringToOUString(m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
         notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-        ::std::unique_ptr<vcl::Window> aTemp2(m_pReportExplorer);
-        m_pReportExplorer = NULL;
-    }
-    {
-        ::std::unique_ptr<vcl::Window> aTemp2(m_pTaskPane);
-        m_pTaskPane = NULL;
     }
 
     m_aSplitWin.disposeAndClear();
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 520b5be..330f54c 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -339,7 +339,6 @@ void OReportController::disposing()
     {
         SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8));
         aDlgOpt.SetWindowState(OStringToOUString(m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
-        ::std::unique_ptr<FloatingWindow> aTemp(m_pGroupsFloater);
         m_pGroupsFloater = NULL;
     }
 
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index b3491b7..4d8c759 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -171,7 +171,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
     sal_uInt16 nId = 1;
     ScModule* pScMod = SC_MOD();
     pScMod->SetRefDialog( nId, true );
-    boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
+    VclPtr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
                                                pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE));
     Show(false, 0);
     if(pDlg->Execute() == RET_OK)
@@ -217,7 +217,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl)
     sal_uInt16 nId = 1;
     ScModule* pScMod = SC_MOD();
     pScMod->SetRefDialog( nId, true );
-    boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(),
+    VclPtr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(),
                                                maPos, condformat::dialog::CONDITION));
     Show(false, 0);
     if(pDlg->Execute() == RET_OK)
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 55a4fd4..a73629c 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -539,7 +539,7 @@ IMPL_LINK( ScDPSubtotalDlg, ClickHdl, PushButton*, pBtn )
 {
     if (pBtn == mpBtnOptions)

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list