diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-13 16:17:00 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-03 06:37:16 +0000 |
commit | 2660d24a07866e083c5135ea263030f3e3a2e729 (patch) | |
tree | 0089d6018d4fc33a7fde955e585e77191cdd258b /sc/source/ui/vba/vbawindow.cxx | |
parent | baba1d14766282bd2c592bffd79ed69f9078cfe1 (diff) |
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>
Diffstat (limited to 'sc/source/ui/vba/vbawindow.cxx')
-rw-r--r-- | sc/source/ui/vba/vbawindow.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 57adf47664e6..6ed0c840c697 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -315,8 +315,8 @@ ScVbaWindow::getCaption() throw (uno::RuntimeException, std::exception) if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() ) { sTitle = sTitle.copy( 0, nCrudIndex ); - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); - OUString sName = workbook.getName(); + uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); + OUString sName = workbook->getName(); // rather bizarre hack to make sure the name behavior // is like XL // if the adjusted title == workbook name, use name @@ -447,16 +447,16 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE void ScVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception) { - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference<ScVbaWorkbook> workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); - workbook.Activate(); + workbook->Activate(); } void ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException, std::exception) { - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); - workbook.Close(SaveChanges, FileName, RouteWorkBook ); + uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); + workbook->Close(SaveChanges, FileName, RouteWorkBook ); } uno::Reference< excel::XPane > SAL_CALL |