From 7b649f835cc00ed76927c6821a135605609bed4e Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 19 Feb 2021 08:40:18 +0200 Subject: loplugin:refcounting in vcl Change-Id: Ieca3dd33a7ae40c3f7b8ba30f763d71a548cd144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111171 Tested-by: Jenkins Reviewed-by: Noel Grandin --- 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 +- 5 files changed, 7 insertions(+), 73 deletions(-) (limited to 'vcl/unx/gtk3') 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 #include #include #include @@ -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 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 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 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(this); - GtkDropTargetDragContext* pContext = new GtkDropTargetDragContext(context, time); + rtl::Reference 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 -- cgit v1.2.3