Permalink
Browse files

new loplugin: refcounting

This was a feature requested by mmeeks, as a result of
tdf#92611.

It validates that things that extend XInterface are not
directly heap/stack-allocated, but have their lifecycle managed
via css::uno::Reference or rtl::Reference.

Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692
Reviewed-on: https://gerrit.libreoffice.org/16924
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
  • Loading branch information...
1 parent baba1d1 commit 2660d24a07866e083c5135ea263030f3e3a2e729 Noel Grandin committed with grandinj Jul 13, 2015
Showing with 779 additions and 487 deletions.
  1. +9 −9 UnoControls/source/controls/framecontrol.cxx
  2. +3 −3 UnoControls/source/inc/framecontrol.hxx
  3. +5 −5 basic/source/inc/namecont.hxx
  4. +1 −1 basic/source/uno/dlgcont.cxx
  5. +44 −44 basic/source/uno/namecont.cxx
  6. +4 −4 basic/source/uno/scriptcont.cxx
  7. +249 −0 compilerplugins/clang/refcounting.cxx
  8. +7 −6 dbaccess/source/core/dataaccess/ComponentDefinition.cxx
  9. +1 −1 dbaccess/source/core/dataaccess/ComponentDefinition.hxx
  10. +2 −2 dbaccess/source/core/dataaccess/datasource.cxx
  11. +1 −1 dbaccess/source/core/dataaccess/datasource.hxx
  12. +5 −5 dbaccess/source/ui/misc/singledoccontroller.cxx
  13. +19 −19 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
  14. +28 −28 editeng/qa/unit/core-test.cxx
  15. +24 −24 editeng/source/accessibility/AccessibleEditableTextPara.cxx
  16. +4 −4 editeng/source/misc/svxacorr.cxx
  17. +2 −2 editeng/source/xml/xmltxtexp.cxx
  18. +6 −6 extensions/source/scanner/sanedlg.cxx
  19. +1 −1 filter/source/svg/svgwriter.cxx
  20. +1 −1 i18npool/inc/calendar_gregorian.hxx
  21. +3 −1 i18npool/source/calendar/calendar_gregorian.cxx
  22. +1 −1 i18npool/source/calendar/calendar_jewish.cxx
  23. +3 −3 i18npool/source/characterclassification/cclass_unicode.cxx
  24. +2 −2 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
  25. +3 −3 i18npool/source/indexentry/indexentrysupplier.cxx
  26. +7 −7 i18npool/source/transliteration/ignoreKana.cxx
  27. +7 −7 i18npool/source/transliteration/ignoreSize_ja_JP.cxx
  28. +7 −7 i18npool/source/transliteration/ignoreWidth.cxx
  29. +6 −6 i18npool/source/transliteration/transliteration_body.cxx
  30. +8 −8 i18npool/source/transliteration/transliteration_caseignore.cxx
  31. +4 −4 oox/source/core/xmlfilterbase.cxx
  32. +4 −5 reportdesign/source/ui/dlg/GroupsSorting.cxx
  33. +21 −21 sax/qa/cppunit/attributes.cxx
  34. +5 −4 sax/qa/cppunit/parser.cxx
  35. +1 −1 sc/source/ui/dbgui/csvcontrol.cxx
  36. +3 −3 sc/source/ui/dbgui/csvgrid.cxx
  37. +1 −1 sc/source/ui/dbgui/csvruler.cxx
  38. +3 −2 sc/source/ui/dbgui/csvtablebox.cxx
  39. +1 −1 sc/source/ui/inc/csvcontrol.hxx
  40. +1 −1 sc/source/ui/inc/csvgrid.hxx
  41. +1 −1 sc/source/ui/inc/csvruler.hxx
  42. +1 −1 sc/source/ui/inc/csvtablebox.hxx
  43. +5 −5 sc/source/ui/unoobj/cellsuno.cxx
  44. +2 −2 sc/source/ui/unoobj/chart2uno.cxx
  45. +8 −8 sc/source/ui/unoobj/docuno.cxx
  46. +10 −10 sc/source/ui/vba/vbafont.cxx
  47. +6 −6 sc/source/ui/vba/vbawindow.cxx
  48. +2 −2 sc/source/ui/vba/vbawindows.cxx
  49. +2 −1 sd/source/ui/inc/EventMultiplexer.hxx
  50. +0 −6 sd/source/ui/tools/EventMultiplexer.cxx
  51. +1 −1 sd/source/ui/view/drviews5.cxx
  52. +3 −3 sdext/source/pdfimport/test/pdf2xml.cxx
  53. +6 −6 sdext/source/pdfimport/test/tests.cxx
  54. +2 −2 svtools/source/edit/svmedit.cxx
  55. +3 −3 svx/source/sdr/contact/viewcontactofgraphic.cxx
  56. +7 −7 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
  57. +2 −2 svx/source/xml/xmlxtexp.cxx
  58. +4 −4 sw/source/core/swg/SwXMLTextBlocks1.cxx
  59. +18 −20 sw/source/core/unocore/unorefmk.cxx
  60. +115 −73 sw/source/filter/ww8/docxattributeoutput.cxx
  61. +19 −17 sw/source/filter/ww8/docxattributeoutput.hxx
  62. +21 −17 sw/source/filter/ww8/docxsdrexport.cxx
  63. +4 −4 sw/source/filter/ww8/docxsdrexport.hxx
  64. +6 −6 sw/source/ui/vba/vbawindow.cxx
  65. +2 −2 sw/source/uibase/config/StoredChapterNumbering.cxx
  66. +3 −3 sw/source/uibase/dbui/dbtree.cxx
  67. +2 −2 ucb/source/ucp/cmis/cmis_content.cxx
  68. +1 −2 ucb/source/ucp/tdoc/tdoc_storage.cxx
  69. +1 −1 uui/source/requeststringresolver.hxx
  70. +2 −2 writerfilter/source/filter/WriterFilter.cxx
  71. +9 −10 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
  72. +2 −2 writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
  73. +2 −2 xmloff/source/meta/xmlversion.cxx
@@ -47,11 +47,11 @@ namespace unocontrols{
// construct/destruct
FrameControl::FrameControl( const Reference< XComponentContext >& rxContext)
- : BaseControl ( rxContext )
- , OBroadcastHelper ( m_aMutex )
- , OPropertySetHelper ( *(static_cast< OBroadcastHelper * >(this)) )
- , m_aInterfaceContainer ( m_aMutex )
- , m_aConnectionPointContainer ( m_aMutex )
+ : BaseControl ( rxContext )
+ , OBroadcastHelper ( m_aMutex )
+ , OPropertySetHelper ( *(static_cast< OBroadcastHelper * >(this)) )
+ , m_aInterfaceContainer ( m_aMutex )
+ , m_aConnectionPointContainer ( new OConnectionPointContainerHelper(m_aMutex) )
{
}
@@ -233,15 +233,15 @@ Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeExcept
Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException, std::exception )
{
// Forwarded to helper class
- return m_aConnectionPointContainer.getConnectionPointTypes();
+ return m_aConnectionPointContainer->getConnectionPointTypes();
}
// XConnectionPointContainer
Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException, std::exception )
{
// Forwarded to helper class
- return m_aConnectionPointContainer.queryConnectionPoint( aType );
+ return m_aConnectionPointContainer->queryConnectionPoint( aType );
}
// XConnectionPointContainer
@@ -250,7 +250,7 @@ void SAL_CALL FrameControl::advise( const Type& aType
const Reference< XInterface >& xListener ) throw( RuntimeException, std::exception )
{
// Forwarded to helper class
- m_aConnectionPointContainer.advise( aType, xListener );
+ m_aConnectionPointContainer->advise( aType, xListener );
}
// XConnectionPointContainer
@@ -259,7 +259,7 @@ void SAL_CALL FrameControl::unadvise( const Type& aTyp
const Reference< XInterface >& xListener ) throw( RuntimeException, std::exception )
{
// Forwarded to helper class
- m_aConnectionPointContainer.unadvise( aType, xListener );
+ m_aConnectionPointContainer->unadvise( aType, xListener );
}
// impl but public method to register service
@@ -211,10 +211,10 @@ private:
private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame;
- OUString m_sComponentURL;
+ OUString m_sComponentURL;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_seqLoaderArguments;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer;
- OConnectionPointContainerHelper m_aConnectionPointContainer;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer;
+ css::uno::Reference<OConnectionPointContainerHelper> m_aConnectionPointContainer;
}; // class FrameControl
@@ -231,7 +231,7 @@ protected:
::osl::Mutex maMutex;
ModifiableHelper maModifiable;
- NameContainer maNameContainer;
+ css::uno::Reference<NameContainer> maNameContainer;
bool mbOldInfoFormat;
bool mbOasis2OOoFormat;
@@ -560,11 +560,11 @@ class SfxLibrary
friend class SfxDialogLibraryContainer;
friend class SfxScriptLibraryContainer;
- css::uno::Reference< css::uno::XComponentContext > mxContext;
- css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
- ModifiableHelper& mrModifiable;
- NameContainer maNameContainer;
+ ModifiableHelper& mrModifiable;
+ css::uno::Reference<NameContainer> maNameContainer;
bool mbLoaded;
bool mbIsModified;
@@ -401,7 +401,7 @@ Reference< css::resource::XStringResourcePersistence >
void SfxDialogLibraryContainer::onNewRootStorage()
{
// the library container is not modified, go through the libraries and check whether they are modified
- Sequence< OUString > aNames = maNameContainer.getElementNames();
+ Sequence< OUString > aNames = maNameContainer->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_Int32 nNameCount = aNames.getLength();
Oops, something went wrong.

0 comments on commit 2660d24

Please sign in to comment.