basctl/source/basicide/baside2.cxx                             |    2 
 basctl/source/basicide/baside2b.cxx                            |    2 
 basctl/source/basicide/bastypes.cxx                            |    6 +-
 basctl/source/basicide/layout.cxx                              |    6 +-
 basctl/source/basicide/linenumberwindow.cxx                    |    2 
 chart2/source/controller/accessibility/AccessibleBase.cxx      |    2 
 chart2/source/controller/accessibility/AccessibleChartView.cxx |    8 +--
 chart2/source/controller/main/ChartWindow.cxx                  |    2 
 compilerplugins/clang/test/vclwidgets.cxx                      |    2 
 compilerplugins/clang/vclwidgets.cxx                           |    5 +-
 dbaccess/source/filter/xml/xmlfilter.cxx                       |    2 
 dbaccess/source/ui/app/AppView.cxx                             |    2 
 dbaccess/source/ui/browser/brwview.cxx                         |    4 -
 dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx        |    2 
 dbaccess/source/ui/querydesign/JoinTableView.cxx               |   12 ++---
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx          |    2 
 dbaccess/source/ui/querydesign/TableWindowListBox.cxx          |    2 
 dbaccess/source/ui/querydesign/TableWindowTitle.cxx            |    2 
 dbaccess/source/ui/querydesign/querycontainerwindow.cxx        |    2 
 dbaccess/source/ui/relationdesign/RelationTableView.cxx        |    2 
 dbaccess/source/ui/tabledesign/TEditControl.cxx                |    2 
 dbaccess/source/ui/tabledesign/TableFieldControl.cxx           |    2 
 drawinglayer/qa/unit/vclmetafileprocessor2d.cxx                |    2 
 extensions/source/bibliography/bibcont.cxx                     |    4 -
 extensions/source/bibliography/bibview.cxx                     |    2 
 extensions/source/bibliography/framectr.cxx                    |    2 
 framework/source/uielement/buttontoolbarcontroller.cxx         |    2 
 framework/source/uielement/complextoolbarcontroller.cxx        |    2 
 framework/source/uielement/generictoolbarcontroller.cxx        |    2 
 framework/source/uielement/toolbarmanager.cxx                  |    2 
 include/vcl/toolkit/field.hxx                                  |    2 
 include/vcl/vclptr.hxx                                         |   12 -----
 reportdesign/source/ui/report/DesignView.cxx                   |    2 
 reportdesign/source/ui/report/ReportSection.cxx                |    2 
 reportdesign/source/ui/report/ReportWindow.cxx                 |    4 -
 reportdesign/source/ui/report/ScrollHelper.cxx                 |    2 
 reportdesign/source/ui/report/SectionWindow.cxx                |    2 
 reportdesign/source/ui/report/StartMarker.cxx                  |    2 
 reportdesign/source/ui/report/ViewsWindow.cxx                  |    2 
 reportdesign/source/ui/report/propbrw.cxx                      |    2 
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx                     |    2 
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx                 |    2 
 sc/source/ui/view/tabview4.cxx                                 |    2 
 sfx2/source/appl/newhelp.cxx                                   |    2 
 sfx2/source/dialog/dinfdlg.cxx                                 |    2 
 sfx2/source/dialog/splitwin.cxx                                |    4 -
 sfx2/source/doc/printhelper.cxx                                |    2 
 sfx2/source/notebookbar/NotebookbarTabControl.cxx              |    2 
 sfx2/source/sidebar/Deck.cxx                                   |    2 
 sfx2/source/sidebar/SidebarController.cxx                      |    2 
 sfx2/source/view/lokstarmathhelper.cxx                         |    4 -
 svtools/source/brwbox/brwhead.cxx                              |    2 
 svtools/source/brwbox/datwin.cxx                               |    2 
 svtools/source/brwbox/editbrowsebox.cxx                        |    4 -
 svtools/source/uno/popupwindowcontroller.cxx                   |    4 -
 svx/source/dialog/svxruler.cxx                                 |    2 
 sw/source/ui/config/optpage.cxx                                |    2 
 sw/source/ui/dialog/swdlgfact.cxx                              |    2 
 sw/source/ui/envelp/envprt.cxx                                 |    2 
 sw/source/uibase/docvw/FrameControlsManager.cxx                |    2 
 sw/source/uibase/docvw/HeaderFooterWin.cxx                     |    2 
 sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx         |    2 
 sw/source/uibase/docvw/PageBreakWin.cxx                        |    4 -
 sw/source/uibase/inc/HeaderFooterWin.hxx                       |    2 
 sw/source/uibase/inc/PageBreakWin.hxx                          |    2 
 sw/source/uibase/misc/swruler.cxx                              |    2 
 toolkit/source/awt/vclxtoolkit.cxx                             |    2 
 toolkit/source/hatchwindow/hatchwindow.cxx                     |    2 
 toolkit/source/helper/btndlg.cxx                               |    2 
 vcl/inc/NotebookbarPopup.hxx                                   |    2 
 vcl/inc/vclstatuslistener.hxx                                  |    2 
 vcl/jsdialog/jsdialogbuilder.cxx                               |   10 ++--
 vcl/qa/cppunit/lifecycle.cxx                                   |    2 
 vcl/source/accessibility/vclxaccessiblecomponent.cxx           |    2 
 vcl/source/accessibility/vclxaccessibletabcontrol.cxx          |    2 
 vcl/source/app/salvtables.cxx                                  |   14 +++---
 vcl/source/app/svapp.cxx                                       |    4 -
 vcl/source/control/MenuButton.cxx                              |    4 -
 vcl/source/control/NotebookbarPopup.cxx                        |    2 
 vcl/source/control/combobox.cxx                                |    4 -
 vcl/source/control/ctrl.cxx                                    |    2 
 vcl/source/control/edit.cxx                                    |    4 -
 vcl/source/control/fixed.cxx                                   |    2 
 vcl/source/control/imp_listbox.cxx                             |    4 -
 vcl/source/control/notebookbar.cxx                             |    4 -
 vcl/source/control/roadmapwizard.cxx                           |    6 +-
 vcl/source/control/spinfld.cxx                                 |    4 -
 vcl/source/control/tabctrl.cxx                                 |    2 
 vcl/source/edit/vclmedit.cxx                                   |    4 -
 vcl/source/gdi/print.cxx                                       |    4 -
 vcl/source/outdev/outdev.cxx                                   |    4 -
 vcl/source/treelist/svtabbx.cxx                                |    2 
 vcl/source/window/brdwin.cxx                                   |    2 
 vcl/source/window/builder.cxx                                  |    2 
 vcl/source/window/dialog.cxx                                   |   14 +++---
 vcl/source/window/dockwin.cxx                                  |   12 ++---
 vcl/source/window/floatwin.cxx                                 |    6 +-
 vcl/source/window/layout.cxx                                   |   22 
+++++-----
 vcl/source/window/menu.cxx                                     |    4 -
 vcl/source/window/menubarwindow.cxx                            |    6 +-
 vcl/source/window/menufloatingwindow.cxx                       |    6 +-
 vcl/source/window/split.cxx                                    |    2 
 vcl/source/window/splitwin.cxx                                 |    4 -
 vcl/source/window/syswin.cxx                                   |    4 -
 vcl/source/window/tabpage.cxx                                  |    4 -
 vcl/source/window/toolbox.cxx                                  |    2 
 vcl/source/window/window.cxx                                   |    2 
 vcl/workben/icontest.cxx                                       |    2 
 108 files changed, 183 insertions(+), 192 deletions(-)

New commits:
commit 374dd9fbd660e95a9e6dd09d121c3528c23020a7
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue May 20 13:59:12 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun May 25 11:23:18 2025 +0200

    Unify on VclPtr::reset
    
    We used to have two duplicating sets: smart pointer-like VclPtr::reset,
    and Reference-style VclPtr::set / VclPtr::clear. There is no need in
    this duplication. Further, in ScopedVclPtr, reset is hidden / removed
    to avoid skipping disposeAndClear; but the twin functions are kept
    accessible, possibly as an overlook.
    
    This change drops Reference-style VclPtr::set / VclPtr::clear, and
    unifies on VclPtr::reset, which looks more consistent with the class
    nature (it is closer to shared_ptr, than to uno::Reference). Doing
    that uncovered one place, where a ScopedVclPtr was used incorrectly:
    clear() was used for NotebookbarPopup::m_pParent in NotebookbarPopup
    dtor. I assume then, that the correct class needed here is VclPtr.
    
    Change-Id: I0746075c58d793fabdce1bc357afea8ee455cd8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185553
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 4d805f65113a..51b01b4ddf94 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1497,7 +1497,7 @@ void ModulWindowLayout::dispose()
 {
     aWatchWindow.disposeAndClear();
     aStackWindow.disposeAndClear();
-    pChild.clear();
+    pChild.reset();
     Layout::dispose();
 }
 
diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 16a1e679ec5a..bc89c3f1511b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2875,7 +2875,7 @@ CodeCompleteWindow::~CodeCompleteWindow()
 void CodeCompleteWindow::dispose()
 {
     m_xListBox.reset();
-    pParent.clear();
+    pParent.reset();
     InterimItemWindow::dispose();
 }
 
diff --git a/basctl/source/basicide/bastypes.cxx 
b/basctl/source/basicide/bastypes.cxx
index e01b9d1861dd..62312bf55795 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -82,8 +82,8 @@ void BaseWindow::dispose()
         pShellVScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() );
     if (pShellHScrollBar && !pShellHScrollBar->isDisposed())
         pShellHScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() );
-    pShellVScrollBar.clear();
-    pShellHScrollBar.clear();
+    pShellVScrollBar.reset();
+    pShellHScrollBar.reset();
     vcl::Window::dispose();
 }
 
@@ -338,7 +338,7 @@ void DockingWindow::dispose()
 {
     m_xContainer.reset();
     m_xBuilder.reset();
-    pLayout.clear();
+    pLayout.reset();
     ResizableDockingWindow::dispose();
 }
 
diff --git a/basctl/source/basicide/layout.cxx 
b/basctl/source/basicide/layout.cxx
index 91e47d863ba9..45faf88dfe40 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -61,7 +61,7 @@ void Layout::dispose()
 {
     aLeftSide.dispose();
     aBottomSide.dispose();
-    pChild.clear();
+    pChild.reset();
     Window::dispose();
 }
 
@@ -179,7 +179,7 @@ void Layout::SplittedSide::dispose()
     for (auto & item : vItems)
     {
         item.pSplit.disposeAndClear();
-        item.pWin.clear();
+        item.pWin.reset();
     }
 }
 
@@ -220,7 +220,7 @@ void Layout::SplittedSide::Remove (DockingWindow* pWin)
         return;
     // remove
     vItems[iWin].pSplit.disposeAndClear();
-    vItems[iWin].pWin.clear();
+    vItems[iWin].pWin.reset();
     vItems.erase(vItems.begin() + iWin);
     // if that was the first one, remove the first splitter line
     if (iWin == 0 && !vItems.empty())
diff --git a/basctl/source/basicide/linenumberwindow.cxx 
b/basctl/source/basicide/linenumberwindow.cxx
index 3f9f97d0e173..65e02c346acc 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -37,7 +37,7 @@ LineNumberWindow::~LineNumberWindow() { disposeOnce(); }
 
 void LineNumberWindow::dispose()
 {
-    m_pModulWindow.clear();
+    m_pModulWindow.reset();
     Window::dispose();
 }
 
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx 
b/chart2/source/controller/accessibility/AccessibleBase.cxx
index a5ce1667559f..1665c18bc88b 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -354,7 +354,7 @@ void SAL_CALL AccessibleBase::disposing()
         OAccessibleComponentHelper::disposing();
 
         // reset pointers
-        m_aAccInfo.m_pWindow.clear();
+        m_aAccInfo.m_pWindow.reset();
         m_aAccInfo.m_pParent = nullptr;
 
         m_nStateSet = AccessibleStateType::DEFUNC;
diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx 
b/chart2/source/controller/accessibility/AccessibleChartView.cxx
index 16685748d509..ce2c7701e6c5 100644
--- a/chart2/source/controller/accessibility/AccessibleChartView.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx
@@ -139,7 +139,7 @@ awt::Rectangle AccessibleChartView::implGetBounds()
 
 void SAL_CALL AccessibleChartView::disposing()
 {
-    m_pChartWindow.clear();
+    m_pChartWindow.reset();
 
     AccessibleBase::disposing();
 }
@@ -221,7 +221,7 @@ void AccessibleChartView::initialize( ChartController& 
rNewChartController,
         xChartModel.clear();
         xChartView.clear();
         xParent.clear();
-        pChartWindow.clear();
+        pChartWindow.reset();
 
         bNewInvalid = true;
     }
@@ -319,7 +319,7 @@ void AccessibleChartView::initialize()
         m_xChartModel = xChartModel.get();
         m_xChartView = xChartView.get();
         m_xParent.clear();
-        m_pChartWindow.clear();
+        m_pChartWindow.reset();
     }
 
     if( bOldInvalid )
@@ -345,7 +345,7 @@ void AccessibleChartView::initialize()
         aAccInfo.m_xChartDocument = m_xChartModel;
         aAccInfo.m_xChartController = m_xChartController;
         aAccInfo.m_xView = m_xChartView;
-        aAccInfo.m_pWindow.clear();
+        aAccInfo.m_pWindow.reset();
         aAccInfo.m_pParent = nullptr;
         aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy;
         aAccInfo.m_pSdrView = m_pSdrView;
diff --git a/chart2/source/controller/main/ChartWindow.cxx 
b/chart2/source/controller/main/ChartWindow.cxx
index c2879e60d35d..ee8b70aab9a8 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -72,7 +72,7 @@ ChartWindow::~ChartWindow()
 void ChartWindow::dispose()
 {
     m_pWindowController = nullptr;
-    m_pViewShellWindow.clear();
+    m_pViewShellWindow.reset();
     vcl::Window::dispose();
 }
 
diff --git a/compilerplugins/clang/test/vclwidgets.cxx 
b/compilerplugins/clang/test/vclwidgets.cxx
index 1ff828e280ad..10f1c3e1bb9a 100644
--- a/compilerplugins/clang/test/vclwidgets.cxx
+++ b/compilerplugins/clang/test/vclwidgets.cxx
@@ -34,7 +34,7 @@ struct Widget : public VclReferenceBase
 
     void dispose() override
     {
-        mpParent.clear();
+        mpParent.reset();
         VclReferenceBase::dispose();
     }
 };
diff --git a/compilerplugins/clang/vclwidgets.cxx 
b/compilerplugins/clang/vclwidgets.cxx
index 422041688a78..0d09e0ff52c6 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -558,7 +558,8 @@ static void findDisposeAndClearStatements(std::set<const 
FieldDecl*>& aVclPtrFie
     if (!isa<CXXMethodDecl>(pCallExpr->getDirectCallee())) return;
     auto check = loplugin::DeclCheck(
         dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee()));
-    if (!(check.Function("disposeAndClear") || check.Function("clear")))
+    // clear() is for containers like std::map<VclPtr<...>, ...>
+    if (!(check.Function("disposeAndClear") || check.Function("reset") || 
check.Function("clear")))
             return;
 
     if (!pCallExpr->getCallee()) return;
@@ -651,7 +652,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* 
functionDecl )
             findDisposeAndClearStatements( aVclPtrFields, 
pMethodDecl->getBody() );
             if (!aVclPtrFields.empty()) {
                 //pMethodDecl->dump();
-                std::string aMessage = BASE_REF_COUNTED_CLASS " subclass 
dispose() method does not call disposeAndClear() or clear() on the following 
field(s): ";
+                std::string aMessage = BASE_REF_COUNTED_CLASS " subclass 
dispose() method does not call disposeAndClear() or reset() on the following 
field(s): ";
                 for(auto s : aVclPtrFields)
                     aMessage += ", " + s->getNameAsString();
                 report(
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx 
b/dbaccess/source/filter/xml/xmlfilter.cxx
index 18a1d223df86..9dc52f514558 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -203,7 +203,7 @@ public:
     FocusWindowWaitGuard()
     {
         SolarMutexGuard aGuard;
-        mpWindow.set(Application::GetFocusWindow());
+        mpWindow.reset(Application::GetFocusWindow());
         if (mpWindow)
             mpWindow->EnterWait();
     }
diff --git a/dbaccess/source/ui/app/AppView.cxx 
b/dbaccess/source/ui/app/AppView.cxx
index ca2e724a1bf3..0d8969c46cbb 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -72,7 +72,7 @@ void OAppBorderWindow::dispose()
     m_xDetailView.reset();
     m_xPanelParent.reset();
     m_xDetailViewParent.reset();
-    m_xView.clear();
+    m_xView.reset();
     InterimItemWindow::dispose();
 }
 
diff --git a/dbaccess/source/ui/browser/brwview.cxx 
b/dbaccess/source/ui/browser/brwview.cxx
index c89d4fe88e42..6a15ce0fca39 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -126,8 +126,8 @@ void UnoDataBrowserView::dispose()
     }
     catch(const Exception&)
     {}
-    m_pTreeView.clear();
-    m_pVclControl.clear();
+    m_pTreeView.reset();
+    m_pVclControl.reset();
     ODataView::dispose();
 }
 
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx 
b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index dc8ae20d50c0..30104237a8e4 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -147,7 +147,7 @@ namespace dbaui
     {
         // clear vector
         clearLineData();
-        m_pParent.clear();
+        m_pParent.reset();
         vcl::Window::dispose();
     }
     Reference< XAccessibleContext > SAL_CALL 
OConnectionLineAccess::getAccessibleContext(  )
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx 
b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 001a76a76d86..f2f263d7f006 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -95,7 +95,7 @@ void OScrollWindowHelper::dispose()
 {
     m_aHScrollBar.disposeAndClear();
     m_aVScrollBar.disposeAndClear();
-    m_pTableView.clear();
+    m_pTableView.reset();
     vcl::Window::dispose();
 }
 
@@ -184,11 +184,11 @@ void OJoinTableView::dispose()
     }
     // delete lists
     clearLayoutInformation();
-    m_pDragWin.clear();
-    m_pSizingWin.clear();
-    m_pSelectedConn.clear();
-    m_pLastFocusTabWin.clear();
-    m_pView.clear();
+    m_pDragWin.reset();
+    m_pSizingWin.reset();
+    m_pSelectedConn.reset();
+    m_pLastFocusTabWin.reset();
+    m_pView.reset();
     m_vTableConnection.clear();
     vcl::Window::dispose();
 }
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx 
b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b674baa0b916..b1b4ae673efa 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -255,7 +255,7 @@ namespace
     public:
         explicit OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent);
         virtual ~OSelectionBrwBoxHeader() override { disposeOnce(); }
-        virtual void dispose() override { m_pBrowseBox.clear(); 
::svt::EditBrowserHeader::dispose(); }
+        virtual void dispose() override { m_pBrowseBox.reset(); 
::svt::EditBrowserHeader::dispose(); }
     };
     OSelectionBrwBoxHeader::OSelectionBrwBoxHeader(OSelectionBrowseBox* 
pParent)
         : ::svt::EditBrowserHeader(pParent,WB_BUTTONSTYLE|WB_DRAG)
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx 
b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index 731aa9f0f0cb..0141b8ed89f4 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -87,7 +87,7 @@ void OTableWindowListBox::dispose()
         Application::RemoveUserEvent(m_nDropEvent);
     if (m_nUiEvent)
         Application::RemoveUserEvent(m_nUiEvent);
-    m_pTabWin.clear();
+    m_pTabWin.reset();
     m_xDragDropTargetHelper.reset();
     m_xTreeView.reset();
     InterimItemWindow::dispose();
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx 
b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 2990a010298b..90f2c615dcba 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -44,7 +44,7 @@ void OTableWindowTitle::dispose()
 {
     m_xImage.reset();
     m_xLabel.reset();
-    m_pTabWin.clear();
+    m_pTabWin.reset();
     InterimItemWindow::dispose();
 }
 
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx 
b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 2c1788620a24..b755dc886aef 100644
--- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
+++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
@@ -64,7 +64,7 @@ namespace dbaui
         }
         if ( m_pBeamer )
             
::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-        m_pBeamer.clear();
+        m_pBeamer.reset();
         if ( m_xBeamer.is() )
         {
             Reference< css::util::XCloseable > xCloseable(m_xBeamer,UNO_QUERY);
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx 
b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index caa4e6534618..9c6b08e1d7ce 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -74,7 +74,7 @@ void ORelationTableView::dispose()
 {
     if ( m_pContainerListener.is() )
         m_pContainerListener->dispose();
-    m_pExistingConnection.clear();
+    m_pExistingConnection.reset();
     OJoinTableView::dispose();
 }
 
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx 
b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 28839d7a9ffd..8ab86caeea15 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -270,7 +270,7 @@ void OTableEditorCtrl::dispose()
     pDescrCell.disposeAndClear();
     pHelpTextCell.disposeAndClear();
     pDescrWin = nullptr;
-    m_pView.clear();
+    m_pView.reset();
     OTableRowView::dispose();
 }
 
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx 
b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
index aa04b914aa4b..fac580c2586a 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
@@ -41,7 +41,7 @@ OTableFieldControl::OTableFieldControl(weld::Container* 
pParent, OTableDesignHel
 
 void OTableFieldControl::dispose()
 {
-    m_xView.clear();
+    m_xView.reset();
 }
 
 OTableFieldControl::~OTableFieldControl()
diff --git a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx 
b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
index 262e50b97290..ad57b8d6b30d 100644
--- a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
@@ -54,7 +54,7 @@ public:
 
     virtual void tearDown() override
     {
-        mVclDevice.clear();
+        mVclDevice.reset();
         mCanvas = uno::Reference<rendering::XCanvas>();
         BootstrapFixture::tearDown();
     }
diff --git a/extensions/source/bibliography/bibcont.cxx 
b/extensions/source/bibliography/bibcont.cxx
index 7e31f8b9b095..61528db15eca 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -134,8 +134,8 @@ void BibBookContainer::dispose()
     }
 
     CloseBibModul( pBibMod );
-    pTopWin.clear();
-    pBottomWin.clear();
+    pTopWin.reset();
+    pBottomWin.reset();
     BibSplitWindow::dispose();
 }
 
diff --git a/extensions/source/bibliography/bibview.cxx 
b/extensions/source/bibliography/bibview.cxx
index 75db3e0d44d0..95385cdd248a 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -75,7 +75,7 @@ namespace bib
     void BibView::dispose()
     {
         VclPtr<BibGeneralPage> pGeneralPage = m_pGeneralPage;
-        m_pGeneralPage.clear();
+        m_pGeneralPage.reset();
         pGeneralPage.disposeAndClear(); // dispose will commit any uncommitted 
weld::Entry changes
 
         if ( m_aFormControlContainer.isFormConnected() )
diff --git a/extensions/source/bibliography/framectr.cxx 
b/extensions/source/bibliography/framectr.cxx
index a565bfb4abfe..cc7c6f4b65d7 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -234,7 +234,7 @@ void BibFrameController_Impl::dispose()
     m_xImpl->aLC.disposeAndClear(aObject);
     m_xDatMan.clear();
     m_aStatusListeners.clear();
-    m_xLastQueriedFocusWin.clear();
+    m_xLastQueriedFocusWin.reset();
     m_xWindow.clear();
     m_xImpl.clear();
 }
diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx 
b/framework/source/uielement/buttontoolbarcontroller.cxx
index 47b31bf99e8a..1366234d0a5a 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -131,7 +131,7 @@ void SAL_CALL ButtonToolbarController::dispose()
         m_xContext.clear();
         m_xURLTransformer.clear();
         m_xFrame.clear();
-        m_pToolbar.clear();
+        m_pToolbar.reset();
         m_bDisposed = true;
     }
 }
diff --git a/framework/source/uielement/complextoolbarcontroller.cxx 
b/framework/source/uielement/complextoolbarcontroller.cxx
index 64611303d1c0..921d83410d1e 100644
--- a/framework/source/uielement/complextoolbarcontroller.cxx
+++ b/framework/source/uielement/complextoolbarcontroller.cxx
@@ -71,7 +71,7 @@ void SAL_CALL ComplexToolbarController::dispose()
     svt::ToolboxController::dispose();
 
     m_xURLTransformer.clear();
-    m_xToolbar.clear();
+    m_xToolbar.reset();
     m_nID = ToolBoxItemId(0);
 }
 
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx 
b/framework/source/uielement/generictoolbarcontroller.cxx
index bc47dfa26c34..8ede4b601e9f 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -124,7 +124,7 @@ void SAL_CALL GenericToolbarController::dispose()
     svt::ToolboxController::dispose();
 
     m_pToolbar = nullptr;
-    m_xToolbar.clear();
+    m_xToolbar.reset();
     m_nID = ToolBoxItemId(0);
 }
 
diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index b80d5ee62c56..df67533e32a2 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -862,7 +862,7 @@ void SAL_CALL ToolBarManager::dispose()
 
         // We have to destroy our toolbar instance now.
         Destroy();
-        m_pToolBar.clear();
+        m_pToolBar.reset();
 
         if ( m_bFrameActionRegistered && m_xFrame.is() )
         {
diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx
index 1a312c99e2ec..977a34ce35b5 100644
--- a/include/vcl/toolkit/field.hxx
+++ b/include/vcl/toolkit/field.hxx
@@ -63,7 +63,7 @@ protected:
     SAL_DLLPRIVATE void ImplResetLocaleDataWrapper() const;
 
     Edit*                   GetField() const            { return mpField; }
-    void                    ClearField() { mpField.clear(); }
+    void                    ClearField() { mpField.reset(); }
 
 public:
     explicit                FormatterBase(Edit* pField);
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index e0e8a95085c1..228a14c27482 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -140,11 +140,6 @@ public:
         return m_rInnerRef.get();
     }
 
-    void set(reference_type *pBody)
-    {
-        m_rInnerRef.set(pBody);
-    }
-
     void reset(reference_type *pBody)
     {
         m_rInnerRef.set(pBody);
@@ -179,11 +174,6 @@ public:
         return m_rInnerRef.get() != nullptr;
     }
 
-    void clear()
-    {
-        m_rInnerRef.clear();
-    }
-
     void reset()
     {
         m_rInnerRef.clear();
@@ -278,7 +268,7 @@ public:
     {
         if (pBody != this->get()) {
             VclPtr<reference_type>::disposeAndClear();
-            VclPtr<reference_type>::set(pBody);
+            VclPtr<reference_type>::reset(pBody);
         }
     }
 
diff --git a/reportdesign/source/ui/report/DesignView.cxx 
b/reportdesign/source/ui/report/DesignView.cxx
index 19d94c56396d..9c798b1394e0 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -59,7 +59,7 @@ class OTaskWindow : public vcl::Window
 public:
     explicit OTaskWindow(vcl::Window* _pParent) : 
Window(_pParent),m_pPropWin(nullptr){}
     virtual ~OTaskWindow() override { disposeOnce(); }
-    virtual void dispose() override { m_pPropWin.clear(); 
vcl::Window::dispose(); }
+    virtual void dispose() override { m_pPropWin.reset(); 
vcl::Window::dispose(); }
 
     void setPropertyBrowser(PropBrw* _pPropWin)
     {
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index de7f0ef69be4..3947cb3c9630 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -125,7 +125,7 @@ void OReportSection::dispose()
         delete m_pView;
         m_pView = nullptr;
     }
-    m_pParent.clear();
+    m_pParent.reset();
     vcl::Window::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx 
b/reportdesign/source/ui/report/ReportWindow.cxx
index 91813270915f..f728578f033f 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -84,8 +84,8 @@ void OReportWindow::dispose()
         m_pReportListener->dispose();
     m_aHRuler.disposeAndClear();
     m_aViewsWindow.disposeAndClear();
-    m_pView.clear();
-    m_pParent.clear();
+    m_pView.reset();
+    m_pParent.reset();
     vcl::Window::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx 
b/reportdesign/source/ui/report/ScrollHelper.cxx
index ba03cc6c4ad5..e028de9c7d5c 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -77,7 +77,7 @@ void OScrollWindowHelper::dispose()
     m_aHScroll.disposeAndClear();
     m_aVScroll.disposeAndClear();
     m_aReportWindow.disposeAndClear();
-    m_pParent.clear();
+    m_pParent.reset();
     OScrollWindowHelper_BASE::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx 
b/reportdesign/source/ui/report/SectionWindow.cxx
index 74624c69662d..eaf3d3bdfefc 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -115,7 +115,7 @@ void OSectionWindow::dispose()
     m_aReportSection.disposeAndClear();
     m_aSplitter.disposeAndClear();
     m_aEndMarker.disposeAndClear();
-    m_pParent.clear();
+    m_pParent.reset();
     vcl::Window::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/StartMarker.cxx 
b/reportdesign/source/ui/report/StartMarker.cxx
index 313313db62dc..170ef063eac1 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -83,7 +83,7 @@ void OStartMarker::dispose()
         s_pDefExpanded = nullptr;
     }
     m_aVRuler.disposeAndClear();
-    m_pParent.clear();
+    m_pParent.reset();
     OColorListener::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx 
b/reportdesign/source/ui/report/ViewsWindow.cxx
index 7ac2a49e14eb..eb425471ea86 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -185,7 +185,7 @@ void OViewsWindow::dispose()
     for (auto& rxSection : m_aSections)
         rxSection.disposeAndClear();
     m_aSections.clear();
-    m_pParent.clear();
+    m_pParent.reset();
     vcl::Window::dispose();
 }
 
diff --git a/reportdesign/source/ui/report/propbrw.cxx 
b/reportdesign/source/ui/report/propbrw.cxx
index 31b94c79a924..5a350b410d1d 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -194,7 +194,7 @@ void PropBrw::dispose()
     {}
 
     
::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-    m_pDesignView.clear();
+    m_pDesignView.reset();
     m_xContentArea.disposeAndClear();
     DockingWindow::dispose();
 }
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index c173d7ca7d8f..5681e2cbfa0f 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -28,7 +28,7 @@ ScPivotLayoutTreeList::~ScPivotLayoutTreeList()
     if (mpSubtotalDlg)
     {
         mpSubtotalDlg->Response(RET_CANCEL);
-        mpSubtotalDlg.clear();
+        mpSubtotalDlg.reset();
     }
 }
 
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 7455613274c1..cb9a757e3899 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -74,7 +74,7 @@ ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
     if (mpFunctionDlg)
     {
         mpFunctionDlg->Response(RET_CANCEL);
-        mpFunctionDlg.clear();
+        mpFunctionDlg.reset();
     }
 }
 
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 7ca7a942aab5..da8572770551 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -45,7 +45,7 @@ void ScTabView::HideTip()
         aTipRectangle = tools::Rectangle();
         nTipAlign = QuickHelpFlags::NONE;
         sTipString.clear();
-        sTopParent.clear();
+        sTopParent.reset();
     }
 }
 
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 82261d007e67..7fb23502f2c6 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1656,7 +1656,7 @@ void SfxHelpTextWindow_Impl::dispose()
     m_xSrchDlg.reset();
     xToolBox.reset();
     xOnStartupCB.reset();
-    xHelpWin.clear();
+    xHelpWin.reset();
     pTextWin.disposeAndClear();
     vcl::Window::dispose();
 }
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 7dd0e642a34d..331ad7f36c3f 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -846,7 +846,7 @@ SfxDocumentPage::~SfxDocumentPage()
     if (m_xPasswordDialog)
     {
         m_xPasswordDialog->Response(RET_CANCEL);
-        m_xPasswordDialog.clear();
+        m_xPasswordDialog.reset();
     }
 }
 
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index fcdb5a548817..51587c201242 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -119,7 +119,7 @@ public:
    virtual void         dispose() override
                         {
                             aTimer.Stop();
-                            pOwner.clear();
+                            pOwner.reset();
                             SplitWindow::dispose();
                         }
 
@@ -292,7 +292,7 @@ void SfxSplitWindow::dispose()
     pEmptyWin.disposeAndClear();
 
     maDockArr.clear();
-    pActive.clear();
+    pActive.reset();
     SplitWindow::dispose();
 }
 
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 45e5b1b26bda..1d4625421165 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -468,7 +468,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
                 SolarMutexGuard aGuard;
                 while( m_pPrinter->IsPrinting() && !Application::IsQuit())
                     Application::Yield();
-                m_pPrinter.clear(); // don't delete it! It's borrowed only :-)
+                m_pPrinter.reset(); // don't delete it! It's borrowed only :-)
             }
             /* } SAFE */
 
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx 
b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 54279c69226e..acad2a2e5ea5 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -114,7 +114,7 @@ public:
         }
         catch( const css::uno::RuntimeException& ) {}
 
-        m_pParent.clear();
+        m_pParent.reset();
     }
 };
 
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 2db1569be919..e1241518fcd9 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -97,7 +97,7 @@ void Deck::dispose()
     mxContents.reset();
     mxVerticalScrollBar.reset();
 
-    mxParentWindow.clear();
+    mxParentWindow.reset();
 
     InterimItemWindow::dispose();
 }
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index dc998d9c7bf1..d4ff65e1795f 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -245,7 +245,7 @@ void SidebarController::disposeDecks()
             mpParentWindow->ReleaseLOKNotifier();
     }
 
-    mpCurrentDeck.clear();
+    mpCurrentDeck.reset();
     maFocusManager.Clear();
     mpResourceManager->disposeDecks();
 }
diff --git a/sfx2/source/view/lokstarmathhelper.cxx 
b/sfx2/source/view/lokstarmathhelper.cxx
index e016341a3259..d58d1c1df72b 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -111,7 +111,7 @@ vcl::Window* LokStarMathHelper::GetGraphicWindow()
         if (mxFrame)
         {
             css::uno::Reference<css::awt::XWindow> xDockerWin = 
mxFrame->getContainerWindow();
-            
mpGraphicWindow.set(FindSmGraphicWindow(VCLUnoHelper::GetWindow(xDockerWin)));
+            
mpGraphicWindow.reset(FindSmGraphicWindow(VCLUnoHelper::GetWindow(xDockerWin)));
         }
     }
 
@@ -121,7 +121,7 @@ vcl::Window* LokStarMathHelper::GetGraphicWindow()
 vcl::Window* LokStarMathHelper::GetWidgetWindow()
 {
     if (!mpWidgetWindow)
-        mpWidgetWindow.set(FindChildSmGraphicWidgetWindow(GetGraphicWindow()));
+        
mpWidgetWindow.reset(FindChildSmGraphicWidgetWindow(GetGraphicWindow()));
 
     return mpWidgetWindow.get();
 }
diff --git a/svtools/source/brwbox/brwhead.cxx 
b/svtools/source/brwbox/brwhead.cxx
index 86ed55d0dfce..1d62ed850ee8 100644
--- a/svtools/source/brwbox/brwhead.cxx
+++ b/svtools/source/brwbox/brwhead.cxx
@@ -43,7 +43,7 @@ BrowserHeader::~BrowserHeader()
 
 void BrowserHeader::dispose()
 {
-    _pBrowseBox.clear();
+    _pBrowseBox.reset();
     HeaderBar::dispose();
 }
 
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index a05c3e3f149c..6e608ef63683 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -212,7 +212,7 @@ void BrowserDataWin::dispose()
     bInDtor = true;
 
     aInvalidRegion.clear();
-    pHeaderBar.clear();
+    pHeaderBar.reset();
     DragSourceHelper::dispose();
     DropTargetHelper::dispose();
     Control::dispose();
diff --git a/svtools/source/brwbox/editbrowsebox.cxx 
b/svtools/source/brwbox/editbrowsebox.cxx
index b88e5ed6cfce..3c5682bc9bb3 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -145,8 +145,8 @@ void EditBrowseBox::dispose()
         Application::RemoveUserEvent(nCellModifiedEvent);
 
     pCheckBoxPaint.disposeAndClear();
-    m_pFocusWhileRequest.clear();
-    pHeader.clear();
+    m_pFocusWhileRequest.reset();
+    pHeader.reset();
     BrowseBox::dispose();
 }
 
diff --git a/svtools/source/uno/popupwindowcontroller.cxx 
b/svtools/source/uno/popupwindowcontroller.cxx
index 18aad5cef74b..91704f589fc8 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -83,7 +83,7 @@ void PopupWindowControllerImpl::SetFloatingWindow()
         mpFloatingWindow.disposeAndClear();
     }
     mpFloatingWindow = mpPopupWindow;
-    mpPopupWindow.clear();
+    mpPopupWindow.reset();
 }
 
 IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclWindowEvent&, 
rWindowEvent, void )
@@ -171,7 +171,7 @@ sal_Bool SAL_CALL PopupWindowController::supportsService( 
const OUString& Servic
 // XComponent
 void SAL_CALL PopupWindowController::dispose()
 {
-    mxInterimPopover.clear();
+    mxInterimPopover.reset();
     mxPopoverContainer.reset();
     mxImpl.reset();
     svt::ToolboxController::dispose();
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 7c60ac13faf6..b1c6fc8c4fa0 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -302,7 +302,7 @@ void SvxRuler::dispose()
 
     pBindings->LeaveRegistrations();
 
-    pEditWin.clear();
+    pEditWin.reset();
     Ruler::dispose();
 }
 
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index c2b2efe7127c..5cda5b5f577c 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -904,7 +904,7 @@ SwStdFontTabPage::~SwStdFontTabPage()
     if (m_bDisposePrinter)
         m_pPrt.disposeAndClear();
     else
-        m_pPrt.clear();
+        m_pPrt.reset();
 }
 
 std::unique_ptr<SfxTabPage> SwStdFontTabPage::Create( weld::Container* pPage, 
weld::DialogController* pController,
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 22375eb34cc3..a29d8e86a175 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1210,7 +1210,7 @@ bool 
AbstractMailMergeWizard_Impl::StartExecuteAsync(AsyncContext& rCtx)
 {
     // SwMailMergeWizardExecutor wants to run the lifecycle of this dialog
     // so clear mxOwner here and leave it up to SwMailMergeWizardExecutor
-    rCtx.mxOwner.clear();
+    rCtx.mxOwner.reset();
     return AbstractDialogImpl_BASE::StartExecuteAsync(rCtx);
 }
 }
diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx
index 3f6ff72b3343..bebb00426ec4 100644
--- a/sw/source/ui/envelp/envprt.cxx
+++ b/sw/source/ui/envelp/envprt.cxx
@@ -73,7 +73,7 @@ SwEnvPrtPage::SwEnvPrtPage(weld::Container* pPage, 
weld::DialogController* pCont
 
 SwEnvPrtPage::~SwEnvPrtPage()
 {
-    m_xPrt.clear();
+    m_xPrt.reset();
 }
 
 IMPL_LINK_NOARG(SwEnvPrtPage, ClickHdl, weld::Toggleable&, void)
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx 
b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 6fb7aac7458f..becd467aaf6f 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -258,7 +258,7 @@ const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame() 
const
 
 void SwFrameMenuButtonBase::dispose()
 {
-    m_pEditWin.clear();
+    m_pEditWin.reset();
     m_pFrame = nullptr;
     m_xVirDev.disposeAndClear();
     InterimItemWindow::dispose();
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 88ca7f659314..f6de9706d4b2 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -269,7 +269,7 @@ void SwHeaderFooterWin::dispose()
 {
     m_xPushButton.reset();
     m_xMenuButton.reset();
-    m_pEditWin.clear();
+    m_pEditWin.reset();
     m_xVirDev.disposeAndClear();
     InterimItemWindow::dispose();
 }
diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx 
b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
index 34f4f92ac992..f524fe6bb20f 100644
--- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
+++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
@@ -61,7 +61,7 @@ void SwOutlineContentVisibilityWin::dispose()
     m_bDestroyed = true;
     m_aDelayTimer.Stop();
 
-    m_pEditWin.clear();
+    m_pEditWin.reset();
     m_pFrame = nullptr;
 
     m_xHideBtn.reset();
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx 
b/sw/source/uibase/docvw/PageBreakWin.cxx
index 41aca8454d7a..7e111f14f5be 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -159,8 +159,8 @@ void SwPageBreakWin::dispose()
     m_aFadeTimer.Stop();
     m_xVirDev.disposeAndClear();
 
-    m_pLine.clear();
-    m_pEditWin.clear();
+    m_pLine.reset();
+    m_pEditWin.reset();
 
     m_xMenuButton.reset();
     InterimItemWindow::dispose();
diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx 
b/sw/source/uibase/inc/HeaderFooterWin.hxx
index 6931e00f82d0..859745292437 100644
--- a/sw/source/uibase/inc/HeaderFooterWin.hxx
+++ b/sw/source/uibase/inc/HeaderFooterWin.hxx
@@ -50,7 +50,7 @@ public:
     SwHeaderFooterDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, bool 
bIsHeader);
 
     virtual ~SwHeaderFooterDashedLine() override { disposeOnce(); }
-    virtual void dispose() override { m_pWin.disposeAndClear(); 
m_pEditWin.clear(); SwDashedLine::dispose(); }
+    virtual void dispose() override { m_pWin.disposeAndClear(); 
m_pEditWin.reset(); SwDashedLine::dispose(); }
 
     virtual const SwFrame* GetFrame() override { return m_pFrame; }
     virtual SwEditWin* GetEditWin() override { return m_pEditWin; }
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx 
b/sw/source/uibase/inc/PageBreakWin.hxx
index 6f6c51217ca7..b4d559db38a1 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -37,7 +37,7 @@ public:
     SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame);
 
     virtual ~SwBreakDashedLine() override { disposeOnce(); }
-    virtual void dispose() override { m_pWin.disposeAndClear(); 
m_pEditWin.clear(); SwDashedLine::dispose(); }
+    virtual void dispose() override { m_pWin.disposeAndClear(); 
m_pEditWin.reset(); SwDashedLine::dispose(); }
 
     virtual void MouseMove(const MouseEvent& rMEvt) override;
 
diff --git a/sw/source/uibase/misc/swruler.cxx 
b/sw/source/uibase/misc/swruler.cxx
index 4d6f5e5e64c2..ee4524d03fea 100644
--- a/sw/source/uibase/misc/swruler.cxx
+++ b/sw/source/uibase/misc/swruler.cxx
@@ -103,7 +103,7 @@ SwCommentRuler::~SwCommentRuler() { disposeOnce(); }
 
 void SwCommentRuler::dispose()
 {
-    mpSwWin.clear();
+    mpSwWin.reset();
     SvxRuler::dispose();
 }
 
diff --git a/toolkit/source/awt/vclxtoolkit.cxx 
b/toolkit/source/awt/vclxtoolkit.cxx
index ff441c07d7a8..4600fc1dd926 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1970,7 +1970,7 @@ css::uno::Reference< css::awt::XWindowPeer > 
VCLXToolkit::createSystemChild( con
             {
                 // system child window could not be created
                 DBG_UNHANDLED_EXCEPTION("toolkit");
-                pChildWindow.clear();
+                pChildWindow.reset();
             }
         }
     }
diff --git a/toolkit/source/hatchwindow/hatchwindow.cxx 
b/toolkit/source/hatchwindow/hatchwindow.cxx
index b4ccadc84a10..63a3522d7237 100644
--- a/toolkit/source/hatchwindow/hatchwindow.cxx
+++ b/toolkit/source/hatchwindow/hatchwindow.cxx
@@ -130,7 +130,7 @@ void SAL_CALL VCLXHatchWindow::setController( const 
uno::Reference< embed::XHatc
 
 void SAL_CALL VCLXHatchWindow::dispose()
 {
-    pHatchWindow.clear();
+    pHatchWindow.reset();
     VCLXWindow::dispose();
 }
 
diff --git a/toolkit/source/helper/btndlg.cxx b/toolkit/source/helper/btndlg.cxx
index 92007425ef9d..529f8010a20e 100644
--- a/toolkit/source/helper/btndlg.cxx
+++ b/toolkit/source/helper/btndlg.cxx
@@ -293,7 +293,7 @@ void ButtonDialog::RemoveButton( sal_uInt16 nId )
         if ((*it)->mbOwnButton)
             (*it)->mpPushButton.disposeAndClear();
         else
-            (*it)->mpPushButton.clear();
+            (*it)->mpPushButton.reset();
         m_ItemList.erase(it);
         return;
     }
diff --git a/vcl/inc/NotebookbarPopup.hxx b/vcl/inc/NotebookbarPopup.hxx
index 8c3bcfee1c77..a14147d6bd9e 100644
--- a/vcl/inc/NotebookbarPopup.hxx
+++ b/vcl/inc/NotebookbarPopup.hxx
@@ -31,7 +31,7 @@ class NotebookbarPopup final : public FloatingWindow
 {
 private:
     VclPtr<VclHBox> m_pBox;
-    ScopedVclPtr<VclHBox> m_pParent;
+    VclPtr<VclHBox> m_pParent;
 
 public:
     explicit NotebookbarPopup(const VclPtr<VclHBox>& pParent);
diff --git a/vcl/inc/vclstatuslistener.hxx b/vcl/inc/vclstatuslistener.hxx
index 38d4b2f86b8a..bdcba899be6e 100644
--- a/vcl/inc/vclstatuslistener.hxx
+++ b/vcl/inc/vclstatuslistener.hxx
@@ -86,7 +86,7 @@ void VclStatusListener<T>::dispose()
         mxDispatch.clear();
     }
     mxFrame.clear();
-    mWidget.clear();
+    mWidget.reset();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index cf74c50a8e62..219e72c2b98b 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -394,7 +394,7 @@ JSInstanceBuilder::~JSInstanceBuilder()
     if (m_aWindowToRelease)
     {
         m_aWindowToRelease->ReleaseLOKNotifier();
-        m_aWindowToRelease.clear();
+        m_aWindowToRelease.reset();
     }
 
     if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar))
@@ -446,7 +446,7 @@ std::unique_ptr<weld::Dialog> 
JSInstanceBuilder::weld_dialog(const OUString& id)
         InsertWindowToMap(getMapIdFromWindowId());
 
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDialog);
+        m_aOwnedToplevel.reset(pDialog);
         m_xBuilder->drop_ownership(pDialog);
         m_bHasTopLevelDialog = true;
 
@@ -474,7 +474,7 @@ std::unique_ptr<weld::Assistant> 
JSInstanceBuilder::weld_assistant(const OUStrin
         InsertWindowToMap(getMapIdFromWindowId());
 
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDialog);
+        m_aOwnedToplevel.reset(pDialog);
         m_xBuilder->drop_ownership(pDialog);
         m_bHasTopLevelDialog = true;
 
@@ -502,7 +502,7 @@ std::unique_ptr<weld::MessageDialog> 
JSInstanceBuilder::weld_message_dialog(cons
         InsertWindowToMap(getMapIdFromWindowId());
 
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pMessageDialog);
+        m_aOwnedToplevel.reset(pMessageDialog);
         m_xBuilder->drop_ownership(pMessageDialog);
         m_bHasTopLevelDialog = true;
 
@@ -837,7 +837,7 @@ std::unique_ptr<weld::Popover> 
JSInstanceBuilder::weld_popover(const OUString& i
     if (pDockingWindow)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDockingWindow);
+        m_aOwnedToplevel.reset(pDockingWindow);
         m_xBuilder->drop_ownership(pDockingWindow);
 
         if (VclPtr<vcl::Window> pWin = 
pDockingWindow->GetParentWithLOKNotifier())
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index eaeed28b9b97..72aa8aadc5df 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -270,7 +270,7 @@ void LifecycleTest::testLeakage()
     }
 
     aObjects.push_back(LeakTestObject::Create<Dialog>(xParent, 
u"PrintProgressDialog"_ustr, "vcl/ui/printprogressdialog.ui"));
-    xParent.clear();
+    xParent.reset();
 
     for (auto i = aObjects.rbegin(); i != aObjects.rend(); ++i)
         (*i)->getRef()->Show();
diff --git a/vcl/source/accessibility/vclxaccessiblecomponent.cxx 
b/vcl/source/accessibility/vclxaccessiblecomponent.cxx
index 6df94b2ee0d6..926342927846 100644
--- a/vcl/source/accessibility/vclxaccessiblecomponent.cxx
+++ b/vcl/source/accessibility/vclxaccessiblecomponent.cxx
@@ -59,7 +59,7 @@ void VCLXAccessibleComponent::DisconnectEvents()
         m_xWindow->RemoveEventListener(LINK(this, VCLXAccessibleComponent, 
WindowEventListener));
         m_xWindow->RemoveChildEventListener(
             LINK(this, VCLXAccessibleComponent, WindowChildEventListener));
-        m_xWindow.clear();
+        m_xWindow.reset();
     }
 }
 
diff --git a/vcl/source/accessibility/vclxaccessibletabcontrol.cxx 
b/vcl/source/accessibility/vclxaccessibletabcontrol.cxx
index 76d2f38c692b..b067cef4ca45 100644
--- a/vcl/source/accessibility/vclxaccessibletabcontrol.cxx
+++ b/vcl/source/accessibility/vclxaccessibletabcontrol.cxx
@@ -49,7 +49,7 @@ 
VCLXAccessibleTabControl::VCLXAccessibleTabControl(vcl::Window* pWindow)
         return;
     if (m_pTabControl->isDisposed())
     {
-        m_pTabControl.clear();
+        m_pTabControl.reset();
         return;
     }
     m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), 
rtl::Reference< VCLXAccessibleTabPage >() );
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 150a446dfade..6c385d4213c1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1885,7 +1885,7 @@ void SalInstanceDialog::undo_collapse()
     m_aHiddenWidgets.clear();
 
     m_xRefEdit->set_width_request(m_nOldEditWidthReq);
-    m_xRefEdit.clear();
+    m_xRefEdit.reset();
     m_xDialog->set_border_width(m_nOldBorderWidth);
     if (vcl::Window* pActionArea = m_xDialog->get_action_area())
         pActionArea->Show();
@@ -7121,7 +7121,7 @@ std::unique_ptr<weld::MessageDialog> 
SalInstanceBuilder::weld_message_dialog(con
     if (pMessageDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pMessageDialog);
+        m_aOwnedToplevel.reset(pMessageDialog);
         m_xBuilder->drop_ownership(pMessageDialog);
     }
     return pRet;
@@ -7135,7 +7135,7 @@ std::unique_ptr<weld::Dialog> 
SalInstanceBuilder::weld_dialog(const OUString& id
     if (pDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDialog);
+        m_aOwnedToplevel.reset(pDialog);
         m_xBuilder->drop_ownership(pDialog);
     }
     return pRet;
@@ -7149,7 +7149,7 @@ std::unique_ptr<weld::Assistant> 
SalInstanceBuilder::weld_assistant(const OUStri
     if (pDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDialog);
+        m_aOwnedToplevel.reset(pDialog);
         m_xBuilder->drop_ownership(pDialog);
     }
     return pRet;
@@ -7163,7 +7163,7 @@ std::unique_ptr<weld::Window> 
SalInstanceBuilder::create_screenshot_window()
     if (SystemWindow* pWindow = dynamic_cast<SystemWindow*>(pRoot))
     {
         std::unique_ptr<weld::Window> xRet(new SalInstanceWindow(pWindow, 
this, false));
-        m_aOwnedToplevel.set(pWindow);
+        m_aOwnedToplevel.reset(pWindow);
         m_xBuilder->drop_ownership(pWindow);
         return xRet;
     }
@@ -7179,7 +7179,7 @@ std::unique_ptr<weld::Window> 
SalInstanceBuilder::create_screenshot_window()
     pRoot->Show();
     xDialog->SetHelpId(pRoot->GetHelpId());
 
-    m_aOwnedToplevel.set(xDialog);
+    m_aOwnedToplevel.reset(xDialog);
 
     return std::unique_ptr<weld::Dialog>(new SalInstanceDialog(xDialog, this, 
false));
 }
@@ -7436,7 +7436,7 @@ std::unique_ptr<weld::Popover> 
SalInstanceBuilder::weld_popover(const OUString&
     if (pDockingWindow)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pDockingWindow);
+        m_aOwnedToplevel.reset(pDockingWindow);
         m_xBuilder->drop_ownership(pDockingWindow);
     }
     return pRet;
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 8053ca9865a3..82aafe8ec37c 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1083,8 +1083,8 @@ void Application::RemoveUserEvent( ImplSVEvent * 
nUserEvent )
         SAL_WARN_IF( !nUserEvent->mbCall, "vcl",
                     "Application::RemoveUserEvent(): Event is already removed" 
);
 
-        nUserEvent->mpWindow.clear();
-        nUserEvent->mpInstanceRef.clear();
+        nUserEvent->mpWindow.reset();
+        nUserEvent->mpInstanceRef.reset();
         nUserEvent->mbCall = false;
     }
 }
diff --git a/vcl/source/control/MenuButton.cxx 
b/vcl/source/control/MenuButton.cxx
index b0e97fa09110..b674fe7c8a7b 100644
--- a/vcl/source/control/MenuButton.cxx
+++ b/vcl/source/control/MenuButton.cxx
@@ -165,10 +165,10 @@ MenuButton::~MenuButton()
 void MenuButton::dispose()
 {
     mpMenuTimer.reset();
-    mpFloatingWindow.clear();
+    mpFloatingWindow.reset();
     if (mpMenu && mbOwnPopupMenu)
         mpMenu->dispose();
-    mpMenu.clear();
+    mpMenu.reset();
     PushButton::dispose();
 }
 
diff --git a/vcl/source/control/NotebookbarPopup.cxx 
b/vcl/source/control/NotebookbarPopup.cxx
index 0e36d2372636..93ae7f6a11bb 100644
--- a/vcl/source/control/NotebookbarPopup.cxx
+++ b/vcl/source/control/NotebookbarPopup.cxx
@@ -108,7 +108,7 @@ void NotebookbarPopup::dispose()
 {
     PopupModeEnd();
     m_pBox.disposeAndClear();
-    m_pParent.clear();
+    m_pParent.reset();
 
     FloatingWindow::dispose();
 }
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 042d858db724..b4371c2d98c5 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -80,7 +80,7 @@ void ComboBox::dispose()
     m_pSubEdit.disposeAndClear();
 
     VclPtr< ImplListBox > pImplLB = m_pImplLB;
-    m_pImplLB.clear();
+    m_pImplLB.reset();
     pImplLB.disposeAndClear();
 
     m_pFloatWin.disposeAndClear();
@@ -185,7 +185,7 @@ void ComboBox::ImplInit(vcl::Window* pParent, WinBits 
eStyle)
         }
     }
 
-    m_pSubEdit.set(VclPtr<Edit>::Create(this, eEditStyle));
+    m_pSubEdit.reset(VclPtr<Edit>::Create(this, eEditStyle));
     m_pSubEdit->EnableRTL( false );
     SetSubEdit( m_pSubEdit );
     m_pSubEdit->SetPosPixel( Point() );
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 2f285c480234..81d2cc99f004 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -57,7 +57,7 @@ Control::~Control()
 void Control::dispose()
 {
     mxLayoutData.reset();
-    mpReferenceDevice.clear();
+    mpReferenceDevice.reset();
     Window::dispose();
 }
 
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 015a956e4703..1c4b9e22c781 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2014,7 +2014,7 @@ void Edit::Command( const CommandEvent& rCEvt )
                 }
             }
         }
-        pPopup.clear();
+        pPopup.reset();
         mbActivePopup = false;
     }
     else if ( rCEvt.GetCommand() == CommandEventId::StartExtTextInput )
@@ -2573,7 +2573,7 @@ void Edit::SetModifyFlag()
 void Edit::SetSubEdit(Edit* pEdit)
 {
     mpSubEdit.disposeAndClear();
-    mpSubEdit.set(pEdit);
+    mpSubEdit.reset(pEdit);
 
     if (mpSubEdit)
     {
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 0f6be7366475..2295b17e0016 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -425,7 +425,7 @@ FixedText::~FixedText()
 void FixedText::dispose()
 {
     set_mnemonic_widget(nullptr);
-    m_pMnemonicWindow.clear();
+    m_pMnemonicWindow.reset();
     Control::dispose();
 }
 
diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index 40da5907e246..ab4c7d614685 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -84,7 +84,7 @@ void ImplEntryList::Clear()
 void ImplEntryList::dispose()
 {
     Clear();
-    mpWindow.clear();
+    mpWindow.reset();
 }
 
 void ImplEntryList::SelectEntry( sal_Int32 nPos, bool bSelect )
@@ -2854,7 +2854,7 @@ ImplListBoxFloatingWindow::~ImplListBoxFloatingWindow()
 
 void ImplListBoxFloatingWindow::dispose()
 {
-    mpImplLB.clear();
+    mpImplLB.reset();
     FloatingWindow::dispose();
 }
 
diff --git a/vcl/source/control/notebookbar.cxx 
b/vcl/source/control/notebookbar.cxx
index a0de7038fb9c..6f143a867dcf 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -137,7 +137,7 @@ void NotebookBar::dispose()
     m_pContextContainers.clear();
     if (m_pSystemWindow && m_pSystemWindow->ImplIsInTaskPaneList(this))
         m_pSystemWindow->GetTaskPaneList()->RemoveWindow(this);
-    m_pSystemWindow.clear();
+    m_pSystemWindow.reset();
 
     if (m_rDisposeLink.IsSet())
         m_rDisposeLink.Call(m_pViewShell);
@@ -296,7 +296,7 @@ void NotebookBar::SetupListener(bool bListen)
 
 void SAL_CALL NotebookBarContextChangeEventListener::disposing(const 
::css::lang::EventObject&)
 {
-    mpParent.clear();
+    mpParent.reset();
 }
 
 void NotebookBar::DataChanged(const DataChangedEvent& rDCEvt)
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index d0c04e0527f1..1827f8573f0d 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -156,9 +156,9 @@ namespace vcl
         while ( mpFirstPage )
             RemovePage( mpFirstPage->mpPage );
 
-        mpCurTabPage.clear();
-        mpPrevBtn.clear();
-        mpNextBtn.clear();
+        mpCurTabPage.reset();
+        mpPrevBtn.reset();
+        mpNextBtn.reset();
         mpRoadmap.disposeAndClear();
         maResponses.clear();
         Dialog::dispose();
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 6582c24cec7b..941ff64f5fef 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -317,11 +317,11 @@ void SpinField::ImplInit(vcl::Window* pParent, WinBits 
nWinStyle)
     if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*GetOutDev(), nWinStyle))
     {
         SetBackground();
-        mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER));
+        mpEdit.reset(VclPtr<Edit>::Create(this, WB_NOBORDER));
         mpEdit->SetBackground();
     }
     else
-        mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER));
+        mpEdit.reset(VclPtr<Edit>::Create(this, WB_NOBORDER));
 
     mpEdit->EnableRTL(false);
     mpEdit->SetPosPixel(Point());
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index e2c06a1dcbec..1d6ffa3a1958 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2261,7 +2261,7 @@ void NotebookbarTabControlBase::dispose()
 
 void NotebookbarTabControlBase::SetToolBox( ToolBox* pToolBox )
 {
-    m_pShortcuts.set( pToolBox );
+    m_pShortcuts.reset( pToolBox );
 }
 
 void NotebookbarTabControlBase::SetIconClickHdl( Link<NotebookBar*, void> aHdl 
)
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 159695e5cd7a..2b9f132b1ca6 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -668,7 +668,7 @@ TextWindow::~TextWindow()
 
 void TextWindow::dispose()
 {
-    mxParent.clear();
+    mxParent.reset();
     mpExtTextView.reset();
     mpExtTextEngine.reset();
     Window::dispose();
@@ -845,7 +845,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
                 mpExtTextEngine->Broadcast( TextHint( SfxHintId::TextModified 
) );
             }
         }
-        pPopup.clear();
+        pPopup.reset();
         mbActivePopup = false;
     }
     else
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 8b6a9f89ce56..daebda8fb0d4 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -926,8 +926,8 @@ void Printer::dispose()
     if ( mpNext )
         mpNext->mpPrev = mpPrev;
 
-    mpPrev.clear();
-    mpNext.clear();
+    mpPrev.reset();
+    mpNext.reset();
     OutputDevice::dispose();
 }
 
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 8b4d816b69bd..43b6650ce4e8 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -179,8 +179,8 @@ void OutputDevice::dispose()
     mxFontCollection.reset();
 
     mpAlphaVDev.disposeAndClear();
-    mpPrevGraphics.clear();
-    mpNextGraphics.clear();
+    mpPrevGraphics.reset();
+    mpNextGraphics.reset();
     VclReferenceBase::dispose();
 }
 
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 0b99201b6702..84cdcfbe5075 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -544,7 +544,7 @@ void SvHeaderTabListBox::dispose()
     m_aAccessibleChildren.clear();
     m_xAccessible.clear();
 
-    m_xHeaderBar.clear();
+    m_xHeaderBar.reset();
     SvTabListBox::dispose();
 }
 
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index e799df338a48..aaa4b5cf47e4 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1609,7 +1609,7 @@ ImplBorderWindow::~ImplBorderWindow()
 void ImplBorderWindow::dispose()
 {
     mpBorderView.reset();
-    mpMenuBarWindow.clear();
+    mpMenuBarWindow.reset();
     mpNotebookBar.disposeAndClear();
     vcl::Window::dispose();
 }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index edf562bd01f8..b9d56812cad8 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -845,7 +845,7 @@ void VclBuilder::disposeBuilder()
         aI->m_pMenu.disposeAndClear();
     }
     m_aMenus.clear();
-    m_pParent.clear();
+    m_pParent.reset();
 }
 
 namespace
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 39f688911406..8c980ddd36b2 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -397,8 +397,8 @@ void Dialog::ImplInitDialogData()
     mbInSyncExecute         = false;
     mbInClose               = false;
     mbModalMode             = false;
-    mpContentArea.clear();
-    mpActionArea.clear();
+    mpContentArea.reset();
+    mpActionArea.reset();
     mnMousePositioned       = 0;
     mpDialogImpl.reset(new DialogImpl);
 }
@@ -593,7 +593,7 @@ Dialog::Dialog(vcl::Window* pParent, WinBits nStyle, 
InitFlag eFlag)
 
 void Dialog::set_action_area(VclButtonBox* pBox)
 {
-    mpActionArea.set(pBox);
+    mpActionArea.reset(pBox);
     if (pBox)
     {
         const DialogStyle& rDialogStyle =
@@ -604,7 +604,7 @@ void Dialog::set_action_area(VclButtonBox* pBox)
 
 void Dialog::set_content_area(VclBox* pBox)
 {
-    mpContentArea.set(pBox);
+    mpContentArea.reset(pBox);
 }
 
 void Dialog::settingOptimalLayoutSize(Window *pBox)
@@ -626,8 +626,8 @@ void Dialog::dispose()
 
     mpDialogImpl->disposeAndClear();
     RemoveFromDlgList();
-    mpActionArea.clear();
-    mpContentArea.clear();
+    mpActionArea.reset();
+    mpContentArea.reset();
 
     const css::uno::Reference< css::uno::XComponentContext >& xContext(
             comphelper::getProcessComponentContext() );
@@ -1102,7 +1102,7 @@ short Dialog::Execute()
     assert (!mpDialogParent || !mpDialogParent->isDisposed());
 #endif
     if ( !xWindow->isDisposed() )
-        xWindow.clear();
+        xWindow.reset();
     else
     {
         OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 29d0f4d9e4c1..e1bd2285f23d 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -121,7 +121,7 @@ void ImplDockFloatWin::dispose()
 
     disposeBuilder();
 
-    mpDockWin.clear();
+    mpDockWin.reset();
     FloatingWindow::dispose();
 }
 
@@ -401,9 +401,9 @@ void DockingWindow::dispose()
         SetFloatingMode(false);
     }
     mpImplData.reset();
-    mpFloatWin.clear();
-    mpOldBorderWin.clear();
-    mpDialogParent.clear();
+    mpFloatWin.reset();
+    mpOldBorderWin.reset();
+    mpDialogParent.reset();
     disposeBuilder();
     Window::dispose();
 }
@@ -1101,7 +1101,7 @@ DropdownDockingWindow::~DropdownDockingWindow()
 
 void DropdownDockingWindow::dispose()
 {
-    m_xBox.clear();
+    m_xBox.reset();
     DockingWindow::dispose();
 }
 
@@ -1139,7 +1139,7 @@ ResizableDockingWindow::~ResizableDockingWindow()
 
 void ResizableDockingWindow::dispose()
 {
-    m_xBox.clear();
+    m_xBox.reset();
     DockingWindow::dispose();
 }
 
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 17e2acf29902..c8f940e58ef5 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -218,9 +218,9 @@ void FloatingWindow::dispose()
 
     mpImplData.reset();
 
-    mpNextFloat.clear();
-    mpFirstPopupModeWin.clear();
-    mxPrevFocusWin.clear();
+    mpNextFloat.reset();
+    mpFirstPopupModeWin.reset();
+    mxPrevFocusWin.reset();
     SystemWindow::dispose();
 }
 
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d102292cdad2..e273a09ea744 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1489,7 +1489,7 @@ VclFrame::~VclFrame()
 
 void VclFrame::dispose()
 {
-    m_pLabel.clear();
+    m_pLabel.reset();
     VclBin::dispose();
 }
 
@@ -2388,10 +2388,10 @@ void MessageDialog::create_message_area()
     VclContainer *pContainer = get_content_area();
     assert(pContainer);
 
-    m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
+    m_pGrid.reset( VclPtr<VclGrid>::Create(pContainer) );
     m_pGrid->reorderWithinParent(0);
     m_pGrid->set_column_spacing(12);
-    m_pMessageBox.set(VclPtr<VclVBox>::Create(m_pGrid));
+    m_pMessageBox.reset(VclPtr<VclVBox>::Create(m_pGrid));
     m_pMessageBox->set_grid_left_attach(1);
     m_pMessageBox->set_grid_top_attach(0);
     m_pMessageBox->set_spacing(GetTextHeight());
@@ -2450,7 +2450,7 @@ void MessageDialog::create_message_area()
         case VclButtonsType::NONE:
             break;
         case VclButtonsType::Ok:
-            pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<OKButton>::Create(pButtonBox) );
             pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
             pBtn->Show();
             pBtn->set_id(u"ok"_ustr);
@@ -2458,7 +2458,7 @@ void MessageDialog::create_message_area()
             nDefaultResponse = RET_OK;
             break;
         case VclButtonsType::Close:
-            pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<CloseButton>::Create(pButtonBox) );
             pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
             pBtn->Show();
             pBtn->set_id(u"close"_ustr);
@@ -2466,7 +2466,7 @@ void MessageDialog::create_message_area()
             nDefaultResponse = RET_CLOSE;
             break;
         case VclButtonsType::Cancel:
-            pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<CancelButton>::Create(pButtonBox) );
             pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
             pBtn->Show();
             pBtn->set_id(u"cancel"_ustr);
@@ -2480,7 +2480,7 @@ void MessageDialog::create_message_area()
             pBtn->set_id(u"yes"_ustr);
             add_button(pBtn, RET_YES, true);
 
-            pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<PushButton>::Create(pButtonBox) );
             pBtn->SetText(GetStandardText(StandardButtonType::No));
             pBtn->Show();
             pBtn->set_id(u"no"_ustr);
@@ -2488,12 +2488,12 @@ void MessageDialog::create_message_area()
             nDefaultResponse = RET_NO;
             break;
         case VclButtonsType::OkCancel:
-            pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<OKButton>::Create(pButtonBox) );
             pBtn->Show();
             pBtn->set_id(u"ok"_ustr);
             add_button(pBtn, RET_OK, true);
 
-            pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+            pBtn.reset( VclPtr<CancelButton>::Create(pButtonBox) );
             pBtn->Show();
             pBtn->set_id(u"cancel"_ustr);
             add_button(pBtn, RET_CANCEL, true);
@@ -2513,10 +2513,10 @@ void MessageDialog::create_owned_areas()
 #else
     set_border_width(12);
 #endif
-    m_pOwnedContentArea.set(VclPtr<VclVBox>::Create(this, false, 24));
+    m_pOwnedContentArea.reset(VclPtr<VclVBox>::Create(this, false, 24));
     set_content_area(m_pOwnedContentArea);
     m_pOwnedContentArea->Show();
-    m_pOwnedActionArea.set( VclPtr<VclHButtonBox>::Create(m_pOwnedContentArea) 
);
+    m_pOwnedActionArea.reset( 
VclPtr<VclHButtonBox>::Create(m_pOwnedContentArea) );
     set_action_area(m_pOwnedActionArea);
     m_pOwnedActionArea->Show();
 }
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index e3df90c51920..632ba6deb314 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -224,8 +224,8 @@ void Menu::dispose()
     // Native-support: destroy SalMenu
     mpSalMenu.reset();
 
-    pStartedFrom.clear();
-    m_pWindow.clear();
+    pStartedFrom.reset();
+    m_pWindow.reset();
     VclReferenceBase::dispose();
 }
 
diff --git a/vcl/source/window/menubarwindow.cxx 
b/vcl/source/window/menubarwindow.cxx
index f55f569d4851..849e179097b9 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -163,9 +163,9 @@ void MenuBarWindow::dispose()
     m_aHideBtn.disposeAndClear();
     m_aFloatBtn.disposeAndClear();
     m_aCloseBtn.disposeAndClear();
-    m_pMenu.clear();
-    m_pActivePopup.clear();
-    m_xSaveFocusId.clear();
+    m_pMenu.reset();
+    m_pActivePopup.reset();
+    m_xSaveFocusId.reset();
 
     Window::dispose();
 }
diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index 0872803a8009..a644ad76e15a 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -118,9 +118,9 @@ MenuFloatingWindow::~MenuFloatingWindow()
 void MenuFloatingWindow::dispose()
 {
     doShutdown();
-    pMenu.clear();
-    pActivePopup.clear();
-    xSaveFocusId.clear();
+    pMenu.reset();
+    pActivePopup.reset();
+    xSaveFocusId.reset();
 
     // unset accessible taken from the PopupMenu (s. CreateAccessible),
     // it is owned and therefore disposed by the PopupMenu
diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx
index adb82ad575c3..25d4f0c605c1 100644
--- a/vcl/source/window/split.cxx
+++ b/vcl/source/window/split.cxx
@@ -154,7 +154,7 @@ void Splitter::dispose()
         TaskPaneList *pTList = pSysWin->GetTaskPaneList();
         pTList->RemoveWindow(this);
     }
-    mpRefWin.clear();
+    mpRefWin.reset();
     Window::dispose();
 }
 
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 2e48a7282870..5c06d8c15be0 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2255,8 +2255,8 @@ void SplitWindow::RemoveItem( sal_uInt16 nId )
     }
 
     // Clear and delete
-    pWindow.clear();
-    pOrgParent.clear();
+    pWindow.reset();
+    pOrgParent.reset();
 }
 
 void SplitWindow::SplitItem( sal_uInt16 nId, tools::Long nNewSize,
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 4f5c08d560b5..ef34222f32fd 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -113,8 +113,8 @@ void SystemWindow::dispose()
     // as a SystemWindow (which it no longer is by then):
     mpWindowImpl->mbSysWin = false;
     disposeBuilder();
-    mpDialogParent.clear();
-    mpMenuBar.clear();
+    mpDialogParent.reset();
+    mpMenuBar.reset();
     Window::dispose();
 }
 
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index b97becf2e05e..f35729d66d76 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -42,14 +42,14 @@ void TabPage::ImplInit( vcl::Window* pParent, WinBits 
nStyle )
         if ( nStyle & WB_AUTOHSCROLL )
         {
             bHasHoriBar = true;
-            m_pHScroll.set(VclPtr<ScrollBar>::Create(this, (WB_HSCROLL | 
WB_DRAG)));
+            m_pHScroll.reset(VclPtr<ScrollBar>::Create(this, (WB_HSCROLL | 
WB_DRAG)));
             m_pHScroll->Show();
             m_pHScroll->SetScrollHdl(aLink);
         }
         if ( nStyle &  WB_AUTOVSCROLL )
         {
             bHasVertBar = true;
-            m_pVScroll.set(VclPtr<ScrollBar>::Create(this, (WB_VSCROLL | 
WB_DRAG)));
+            m_pVScroll.reset(VclPtr<ScrollBar>::Create(this, (WB_VSCROLL | 
WB_DRAG)));
             m_pVScroll->Show();
             m_pVScroll->SetScrollHdl(aLink);
         }
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 3cbd2db0c3f2..945ac78784f0 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1311,7 +1311,7 @@ void ToolBox::dispose()
     delete pSVData->maCtrlData.mpTBDragMgr;
     pSVData->maCtrlData.mpTBDragMgr = nullptr;
 
-    mpFloatWin.clear();
+    mpFloatWin.reset();
 
     mpIdle.reset();
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 93c13fa7cfab..8e08e461fd35 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3977,7 +3977,7 @@ void WindowOutputDevice::dispose()
     ::OutputDevice::dispose();
     // need to do this after OutputDevice::dispose so that the call to 
WindowOutputDevice::ReleaseGraphics
     // can release the graphics properly
-    mxOwnerWindow.clear();
+    mxOwnerWindow.reset();
 }
 
 css::awt::DeviceInfo WindowOutputDevice::GetDeviceInfo() const
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index c94f3bb7e3d5..956e070e5c9d 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -65,7 +65,7 @@ public:
 
     MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
     virtual ~MyWorkWindow() override { disposeOnce(); }
-    virtual void dispose() override { mpFixedBitmap.clear(); 
WorkWindow::dispose(); }
+    virtual void dispose() override { mpFixedBitmap.reset(); 
WorkWindow::dispose(); }
     void LoadGraphic( const OUString& sImageFile );
 
     virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const 
tools::Rectangle& rRect ) override;

Reply via email to