[Libreoffice-commits] core.git: sw/source

Takeshi Abe tabe at fixedpoint.jp
Fri Feb 28 12:20:20 PST 2014


 sw/source/core/unocore/unochart.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f9e365d138732d8cdc29dc08efaf1e86b88ecd6c
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Feb 28 22:52:59 2014 +0900

    Avoid a resource leak
    
    It seems an aged mistake to pass pUnoCrsr to a std::auto_ptr too early
    
    Change-Id: I99ab2d8c8719fb9f0fc3e90f36534007b4cde990
    Reviewed-on: https://gerrit.libreoffice.org/8393
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 5bd2558..c144ae4 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <memory>
 #include <algorithm>
 
 #include <com/sun/star/chart/ChartDataRowSource.hpp>
@@ -46,6 +45,7 @@
 #include <docary.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star;
 
@@ -684,9 +684,9 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
     // get table format for that single table from above
     SwFrmFmt    *pTblFmt  = 0;      // pointer to table format
     SwUnoCrsr   *pUnoCrsr = 0;      // here required to check if the cells in the range do actually exist
-    std::auto_ptr< SwUnoCrsr > pAuto( pUnoCrsr );  // to end lifetime of object pointed to by pUnoCrsr
     if (aSubRanges.getLength() > 0)
         GetFormatAndCreateCursorFromRangeRep( pDoc, pSubRanges[0], &pTblFmt, &pUnoCrsr );
+    boost::scoped_ptr< SwUnoCrsr > pAuto( pUnoCrsr );  // to end lifetime of object pointed to by pUnoCrsr
     if (!pTblFmt || !pUnoCrsr)
         throw lang::IllegalArgumentException();
 


More information about the Libreoffice-commits mailing list