vcl/inc/graphic/UnoGraphic.hxx                    |    4 -
 vcl/inc/graphic/UnoGraphicDescriptor.hxx          |    3 
 vcl/inc/unx/gtk/gtkdata.hxx                       |   63 +++++++++++++++++++-
 vcl/source/app/salvtables.cxx                     |    6 -
 vcl/source/app/unohelp2.cxx                       |    2 
 vcl/source/control/edit.cxx                       |    5 -
 vcl/source/edit/textview.cxx                      |    7 --
 vcl/source/gdi/graph.cxx                          |    2 
 vcl/source/gdi/pdfwriter_impl2.cxx                |    2 
 vcl/source/gdi/vectorgraphicdata.cxx              |    3 
 vcl/source/graphic/UnoGraphicProvider.cxx         |   12 +--
 vcl/unx/gtk3/a11y/gtk3atkutil.cxx                 |   68 ----------------------
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx         |    6 -
 vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx       |    3 
 vcl/unx/gtk3/gtk3gtkdata.cxx                      |    1 
 vcl/unx/gtk3/gtk3gtkframe.cxx                     |    2 
 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx |    4 -
 xmlhelp/source/treeview/tvfactory.cxx             |    3 
 18 files changed, 90 insertions(+), 106 deletions(-)

New commits:
commit 7b649f835cc00ed76927c6821a135605609bed4e
Author:     Noel <noel.gran...@collabora.co.uk>
AuthorDate: Fri Feb 19 08:40:18 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Feb 19 08:46:44 2021 +0100

    loplugin:refcounting in vcl
    
    Change-Id: Ieca3dd33a7ae40c3f7b8ba30f763d71a548cd144
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111171
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index 33f97df5b183..be2991eb6a5d 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -44,14 +44,12 @@ public:
     using ::unographic::GraphicDescriptor::init;
     void init(const ::Graphic& rGraphic);
 
-private:
-
     // XInterface
     virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & 
rType ) override;
     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
     virtual void SAL_CALL acquire() throw() override;
     virtual void SAL_CALL release() throw() override;
-
+private:
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx 
b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
index ad46952ce925..db39c070deda 100644
--- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx
+++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
@@ -74,8 +74,6 @@ public:
     void init( const OUString& rURL );
     void init( const css::uno::Reference< css::io::XInputStream >& rxIStm, 
const OUString& rURL );
 
-protected:
-
     static rtl::Reference<::comphelper::PropertySetInfo> 
createPropertySetInfo();
 
     // XInterface
@@ -84,6 +82,7 @@ protected:
     virtual void SAL_CALL acquire() throw() override;
     virtual void SAL_CALL release() throw() override;
 
+protected:
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 2f88ffe8b309..976412cfb6d5 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -25,6 +25,8 @@
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
 #include <unx/gendata.hxx>
 #include <unx/saldisp.hxx>
 #include <unx/gtk/gtksys.hxx>
@@ -58,6 +60,64 @@ public:
     sal_uLong    m_nTimeoutMS;
 };
 
+class DocumentFocusListener :
+    public ::cppu::WeakImplHelper< 
css::accessibility::XAccessibleEventListener >
+{
+
+    o3tl::sorted_vector< css::uno::Reference< css::uno::XInterface > > 
m_aRefList;
+
+public:
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void attachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessible >& 
xAccessible
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void attachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessible >& 
xAccessible,
+        const css::uno::Reference< css::accessibility::XAccessibleContext >& 
xContext
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void attachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessible >& 
xAccessible,
+        const css::uno::Reference< css::accessibility::XAccessibleContext >& 
xContext,
+        const css::uno::Reference< css::accessibility::XAccessibleStateSet >& 
xStateSet
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void detachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessible >& 
xAccessible
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void detachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessibleContext >& 
xContext
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    void detachRecursive(
+        const css::uno::Reference< css::accessibility::XAccessibleContext >& 
xContext,
+        const css::uno::Reference< css::accessibility::XAccessibleStateSet >& 
xStateSet
+    );
+
+    /// @throws lang::IndexOutOfBoundsException
+    /// @throws uno::RuntimeException
+    static css::uno::Reference< css::accessibility::XAccessible > 
getAccessible(const css::lang::EventObject& aEvent );
+
+    // XEventListener
+    virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) 
override;
+
+    // XAccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const 
css::accessibility::AccessibleEventObject& aEvent ) override;
+};
+
 class GtkSalData final : public GenericUnixSalData
 {
     GSource*        m_pUserEvent;
@@ -65,8 +125,7 @@ class GtkSalData final : public GenericUnixSalData
     osl::Condition  m_aDispatchCondition;
     std::exception_ptr m_aException;
 
-    css::uno::Reference<css::accessibility::XAccessibleEventListener> 
m_xDocumentFocusListener;
-    DocumentFocusListener * m_pDocumentFocusListener;
+    rtl::Reference<DocumentFocusListener> m_xDocumentFocusListener;
 
 public:
     GtkSalData( SalInstance *pInstance );
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 378a43f54896..31964747cd11 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5936,8 +5936,8 @@ a11yref SalInstanceDrawingArea::get_accessible_parent()
 
 a11yrelationset SalInstanceDrawingArea::get_accessible_relation_set()
 {
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new 
utl::AccessibleRelationSetHelper;
-    css::uno::Reference<css::accessibility::XAccessibleRelationSet> xSet = 
pRelationSetHelper;
+    rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper
+        = new utl::AccessibleRelationSetHelper;
     vcl::Window* pWindow = m_xDrawingArea.get();
     if (pWindow)
     {
@@ -5960,7 +5960,7 @@ a11yrelationset 
SalInstanceDrawingArea::get_accessible_relation_set()
                 css::accessibility::AccessibleRelationType::MEMBER_OF, 
aSequence));
         }
     }
-    return xSet;
+    return pRelationSetHelper;
 }
 
 Point SalInstanceDrawingArea::get_accessible_location()
diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx
index bc3e64573ab2..ab53a4c7f27f 100644
--- a/vcl/source/app/unohelp2.cxx
+++ b/vcl/source/app/unohelp2.cxx
@@ -47,7 +47,7 @@ namespace vcl::unohelper {
         if ( !rxClipboard.is() )
             return;
 
-        TextDataObject* pDataObj = new TextDataObject( rContent );
+        rtl::Reference<TextDataObject> pDataObj = new TextDataObject( rContent 
);
 
         SolarMutexReleaser aReleaser;
         try
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 93fb2151d25f..d1322a4dcc65 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -282,8 +282,7 @@ void Edit::ImplInitEditData()
     // note: controls that use a subedit will revert this (SpinField, ComboBox)
     EnableRTL( false );
 
-    vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new 
vcl::unohelper::DragAndDropWrapper( this );
-    mxDnDListener = pDnDWrapper;
+    mxDnDListener = new vcl::unohelper::DragAndDropWrapper( this );
 }
 
 bool Edit::ImplUseNativeBorder(vcl::RenderContext const & rRenderContext, 
WinBits nStyle)
@@ -2757,7 +2756,7 @@ void Edit::dragGestureRecognized( const 
css::datatransfer::dnd::DragGestureEvent
     if ( IsTracking() )
         EndTracking();  // before D&D disable tracking
 
-    vcl::unohelper::TextDataObject* pDataObj = new 
vcl::unohelper::TextDataObject( GetSelected() );
+    rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new 
vcl::unohelper::TextDataObject( GetSelected() );
     sal_Int8 nActions = datatransfer::dnd::DNDConstants::ACTION_COPY;
     if ( !IsReadOnly() )
         nActions |= datatransfer::dnd::DNDConstants::ACTION_MOVE;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 73a68de7ca42..9d37d83827f5 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -177,8 +177,7 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* 
pWindow ) :
 
     if ( pWindow->GetDragGestureRecognizer().is() )
     {
-        vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new 
vcl::unohelper::DragAndDropWrapper( this );
-        mpImpl->mxDnDListener = pDnDWrapper;
+        mpImpl->mxDnDListener = new vcl::unohelper::DragAndDropWrapper( this );
 
         css::uno::Reference< css::datatransfer::dnd::XDragGestureListener> 
xDGL( mpImpl->mxDnDListener, css::uno::UNO_QUERY );
         pWindow->GetDragGestureRecognizer()->addDragGestureListener( xDGL );
@@ -887,7 +886,7 @@ void TextView::Copy( css::uno::Reference< 
css::datatransfer::clipboard::XClipboa
     if ( !rxClipboard.is() )
         return;
 
-    TETextDataObject* pDataObj = new TETextDataObject( GetSelected() );
+    rtl::Reference<TETextDataObject> pDataObj = new TETextDataObject( 
GetSelected() );
 
     SolarMutexReleaser aReleaser;
 
@@ -1728,7 +1727,7 @@ void TextView::dragGestureRecognized( const 
css::datatransfer::dnd::DragGestureE
     mpImpl->mpDDInfo.reset(new TextDDInfo);
     mpImpl->mpDDInfo->mbStarterOfDD = true;
 
-    TETextDataObject* pDataObj = new TETextDataObject( GetSelected() );
+    rtl::Reference<TETextDataObject> pDataObj = new TETextDataObject( 
GetSelected() );
 
     mpImpl->mpCursor->Hide();
 
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index ac47534058bb..b4b934ee2f49 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -353,7 +353,7 @@ uno::Reference<graphic::XGraphic> Graphic::GetXGraphic() 
const
 
     if (GetType() != GraphicType::NONE)
     {
-        unographic::Graphic* pUnoGraphic = new unographic::Graphic;
+        rtl::Reference<unographic::Graphic> pUnoGraphic = new 
unographic::Graphic;
         pUnoGraphic->init(*this);
         xGraphic = pUnoGraphic;
     }
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx 
b/vcl/source/gdi/pdfwriter_impl2.cxx
index 304647aa1233..862717adfd4e 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -1143,7 +1143,7 @@ uno::Reference< beans::XMaterialHolder > 
PDFWriterImpl::initEncryption( const OU
     uno::Reference< beans::XMaterialHolder > xResult;
     if( !i_rOwnerPassword.isEmpty() || !i_rUserPassword.isEmpty() )
     {
-        EncHashTransporter* pTransporter = new EncHashTransporter;
+        rtl::Reference<EncHashTransporter> pTransporter = new 
EncHashTransporter;
         xResult = pTransporter;
 
         // get padded passwords
diff --git a/vcl/source/gdi/vectorgraphicdata.cxx 
b/vcl/source/gdi/vectorgraphicdata.cxx
index 608251dc62c9..8430ebe2b289 100644
--- a/vcl/source/gdi/vectorgraphicdata.cxx
+++ b/vcl/source/gdi/vectorgraphicdata.cxx
@@ -252,8 +252,7 @@ void VectorGraphicData::ensureSequenceAndRange()
                 {"PageIndex", uno::makeAny<sal_Int32>(mnPageIndex)},
             });
 
-            auto* pUnoBinaryDataContainer = new 
UnoBinaryDataContainer(getBinaryDataContainer());
-            uno::Reference<util::XBinaryDataContainer> xDataContainer = 
pUnoBinaryDataContainer;
+            rtl::Reference<UnoBinaryDataContainer> xDataContainer = new 
UnoBinaryDataContainer(getBinaryDataContainer());
 
             auto xPrimitive2D = 
xPdfDecomposer->getDecomposition(xDataContainer, aDecompositionParameters);
             maSequence = 
comphelper::sequenceToContainer<std::deque<uno::Reference<graphic::XPrimitive2D>>>(xPrimitive2D);
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 73147b907d8e..448aba60bb2c 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -131,7 +131,7 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadMemory( const OUS
 
         if( nGraphicAddress )
         {
-            ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
+            rtl::Reference<::unographic::Graphic> pUnoGraphic = new 
::unographic::Graphic;
 
             pUnoGraphic->init( *reinterpret_cast< ::Graphic* >( 
nGraphicAddress ) );
             xRet = pUnoGraphic;
@@ -211,7 +211,7 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadBitmap( const uno
 
     if( !aBmpEx.IsEmpty() )
     {
-        ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
+        rtl::Reference<::unographic::Graphic> pUnoGraphic = new 
::unographic::Graphic;
 
         pUnoGraphic->init( aBmpEx );
         xRet = pUnoGraphic;
@@ -253,7 +253,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL 
GraphicProvider::queryGraphicDesc
 
     if( xIStm.is() )
     {
-        unographic::GraphicDescriptor* pDescriptor = new 
unographic::GraphicDescriptor;
+        rtl::Reference<unographic::GraphicDescriptor> pDescriptor = new 
unographic::GraphicDescriptor;
         pDescriptor->init( xIStm, aURL );
         xRet = pDescriptor;
     }
@@ -273,7 +273,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL 
GraphicProvider::queryGraphicDesc
         }
         else
         {
-            unographic::GraphicDescriptor* pDescriptor = new 
unographic::GraphicDescriptor;
+            rtl::Reference<unographic::GraphicDescriptor> pDescriptor = new 
unographic::GraphicDescriptor;
             pDescriptor->init( aURL );
             xRet = pDescriptor;
         }
@@ -423,7 +423,7 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL 
GraphicProvider::queryGraphic( co
                 if (!aPath.isEmpty() && bLoadAsLink)
                     aVCLGraphic.setOriginURL(aPath);
 
-                ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
+                rtl::Reference<::unographic::Graphic> pUnoGraphic = new 
::unographic::Graphic;
 
                 pUnoGraphic->init( aVCLGraphic );
                 xRet = pUnoGraphic;
@@ -473,7 +473,7 @@ uno::Sequence< uno::Reference<graphic::XGraphic> > SAL_CALL 
GraphicProvider::que
 
         if (pGraphic)
         {
-            auto pUnoGraphic = new unographic::Graphic();
+            rtl::Reference<unographic::Graphic> pUnoGraphic = new 
unographic::Graphic();
             pUnoGraphic->init(*pGraphic);
             xGraphic = pUnoGraphic;
         }
diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx 
b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
index 08d98784f8bf..d1f46a8ccef7 100644
--- a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx
@@ -23,7 +23,6 @@
 #undef _LINUX_SOURCE_COMPAT
 #endif
 
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -131,66 +130,6 @@ atk_wrapper_focus_tracker_notify_when_idle( const 
uno::Reference< accessibility:
 
 /*****************************************************************************/
 
-class DocumentFocusListener :
-    public ::cppu::WeakImplHelper< accessibility::XAccessibleEventListener >
-{
-
-    o3tl::sorted_vector< uno::Reference< uno::XInterface > > m_aRefList;
-
-public:
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void attachRecursive(
-        const uno::Reference< accessibility::XAccessible >& xAccessible
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void attachRecursive(
-        const uno::Reference< accessibility::XAccessible >& xAccessible,
-        const uno::Reference< accessibility::XAccessibleContext >& xContext
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void attachRecursive(
-        const uno::Reference< accessibility::XAccessible >& xAccessible,
-        const uno::Reference< accessibility::XAccessibleContext >& xContext,
-        const uno::Reference< accessibility::XAccessibleStateSet >& xStateSet
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void detachRecursive(
-        const uno::Reference< accessibility::XAccessible >& xAccessible
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void detachRecursive(
-        const uno::Reference< accessibility::XAccessibleContext >& xContext
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    void detachRecursive(
-        const uno::Reference< accessibility::XAccessibleContext >& xContext,
-        const uno::Reference< accessibility::XAccessibleStateSet >& xStateSet
-    );
-
-    /// @throws lang::IndexOutOfBoundsException
-    /// @throws uno::RuntimeException
-    static uno::Reference< accessibility::XAccessible > getAccessible(const 
lang::EventObject& aEvent );
-
-    // XEventListener
-    virtual void SAL_CALL disposing( const lang::EventObject& Source ) 
override;
-
-    // XAccessibleEventListener
-    virtual void SAL_CALL notifyEvent( const 
accessibility::AccessibleEventObject& aEvent ) override;
-};
-
-/*****************************************************************************/
-
 void DocumentFocusListener::disposing( const lang::EventObject& aEvent )
 {
 
@@ -511,12 +450,11 @@ WindowList g_aWindowList;
 
 DocumentFocusListener & GtkSalData::GetDocumentFocusListener()
 {
-    if (!m_pDocumentFocusListener)
+    if (!m_xDocumentFocusListener)
     {
-        m_pDocumentFocusListener = new DocumentFocusListener;
-        m_xDocumentFocusListener.set(m_pDocumentFocusListener);
+        m_xDocumentFocusListener = new DocumentFocusListener;
     }
-    return *m_pDocumentFocusListener;
+    return *m_xDocumentFocusListener;
 }
 
 static void handle_get_focus(::VclWindowEvent const * pEvent)
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index dada6d4556b0..bf9336f5a51f 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -908,8 +908,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
     }
     if (pParent)
         gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent);
-    RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
-    uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
+    rtl::Reference<RunDialog> pRunDialog = new RunDialog(m_pDialog, xToolkit, 
xDesktop);
     while( GTK_RESPONSE_NO == btn )
     {
         btn = GTK_RESPONSE_YES; // we don't want to repeat unless user clicks 
NO for file save.
@@ -996,8 +995,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
                                 
OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
                                 RTL_TEXTENCODING_UTF8 ).getStr() );
                             gtk_window_set_transient_for(GTK_WINDOW(dlg), 
GTK_WINDOW(m_pDialog));
-                            RunDialog* pAnotherDialog = new RunDialog(dlg, 
xToolkit, xDesktop);
-                            uno::Reference < awt::XTopWindowListener > 
xAnotherLifeCycle(pAnotherDialog);
+                            rtl::Reference<RunDialog> pAnotherDialog = new 
RunDialog(dlg, xToolkit, xDesktop);
                             btn = pAnotherDialog->run();
 
                             gtk_widget_destroy( dlg );
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
index 8d8319daf3ba..24bf857544d0 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
@@ -136,8 +136,7 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute()
     GtkWindow *pParent = RunDialog::GetTransientFor();
     if (pParent)
         gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent);
-    RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
-    uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
+    rtl::Reference<RunDialog> pRunDialog = new RunDialog(m_pDialog, xToolkit, 
xDesktop);
     gint nStatus = pRunDialog->run();
     switch( nStatus )
     {
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index 1e46fd69b8bc..8626252f40e6 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -313,7 +313,6 @@ GtkSalData::GtkSalData( SalInstance *pInstance )
     : GenericUnixSalData( SAL_DATA_GTK3, pInstance )
     , m_aDispatchMutex()
     , m_aDispatchCondition()
-    , m_pDocumentFocusListener(nullptr)
 {
     m_pUserEvent = nullptr;
 }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index fb013d2a95ca..dde5c7bdef6e 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3786,7 +3786,7 @@ gboolean GtkDropTarget::signalDragMotion(GtkWidget 
*pWidget, GdkDragContext *con
 
     css::datatransfer::dnd::DropTargetDragEnterEvent aEvent;
     aEvent.Source = static_cast<css::datatransfer::dnd::XDropTarget*>(this);
-    GtkDropTargetDragContext* pContext = new GtkDropTargetDragContext(context, 
time);
+    rtl::Reference<GtkDropTargetDragContext> pContext = new 
GtkDropTargetDragContext(context, time);
     //preliminary accept the Drag and select the preferred action, the fire_* 
will
     //inform the original caller of our choice and the callsite can decide
     //to overrule this choice. i.e. typically here we default to ACTION_MOVE
commit 34ad5eaebf6548f6006d97aa46837ca1f1dd141b
Author:     Noel <noel.gran...@collabora.co.uk>
AuthorDate: Fri Feb 19 08:39:29 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Feb 19 08:46:22 2021 +0100

    loplugin:refcounting in xmlhelp
    
    Change-Id: Ida82bee18d0828f299db0e87ecb2faf67432dc4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111170
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx 
b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 4a88add7e5b2..9f8d96150e74 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -499,9 +499,7 @@ void SAL_CALL ResultSetBase::removeVetoableChangeListener(
 uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
 ResultSetBase::getMetaData()
 {
-    ::ucbhelper::ResultSetMetaData* p =
-          new ::ucbhelper::ResultSetMetaData( m_xContext, m_sProperty );
-    return uno::Reference< sdbc::XResultSetMetaData >( p );
+    return new ::ucbhelper::ResultSetMetaData( m_xContext, m_sProperty );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlhelp/source/treeview/tvfactory.cxx 
b/xmlhelp/source/treeview/tvfactory.cxx
index fb879a5c3229..ec2790032b6d 100644
--- a/xmlhelp/source/treeview/tvfactory.cxx
+++ b/xmlhelp/source/treeview/tvfactory.cxx
@@ -83,8 +83,7 @@ TVFactory::createInstanceWithArguments(
 {
     if( ! m_xHDS.is() )
     {
-        cppu::OWeakObject* p = new TVChildTarget( m_xContext );
-        m_xHDS.set( p );
+        m_xHDS = static_cast<cppu::OWeakObject*>(new TVChildTarget( m_xContext 
));
     }
 
     OUString hierview;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to