[Libreoffice-commits] .: editeng/inc editeng/source

David Tardon dtardon at kemper.freedesktop.org
Wed Feb 16 01:00:47 PST 2011


 editeng/inc/editeng/unotext.hxx |    4 +-
 editeng/source/uno/unotext.cxx  |   65 ----------------------------------------
 2 files changed, 3 insertions(+), 66 deletions(-)

New commits:
commit 376a4ecf10c57274f01887231ec52c618d91e57e
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Feb 16 09:59:13 2011 +0100

    use osl::DebugBase for debugging live instances

diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx
index ebd0576..6f0d9ff 100644
--- a/editeng/inc/editeng/unotext.hxx
+++ b/editeng/inc/editeng/unotext.hxx
@@ -56,6 +56,7 @@
 #include <cppuhelper/interfacecontainer.h>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/weakagg.hxx>
+#include <osl/diagnose.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <tools/link.hxx>
@@ -256,7 +257,8 @@ class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTe
                             public ::com::sun::star::beans::XPropertyState,
                             public ::com::sun::star::lang::XServiceInfo,
                             public ::com::sun::star::text::XTextRangeCompare,
-                            public ::com::sun::star::lang::XUnoTunnel
+                            public ::com::sun::star::lang::XUnoTunnel,
+                            private osl::DebugBase<SvxUnoTextRangeBase>
 
 {
     friend class SvxUnoTextRangeEnumeration;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 3acc7fe..42118c6 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -191,65 +191,11 @@ void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) thr
 // class SvxUnoTextRangeBase
 // ====================================================================
 
-#ifdef DEBUG
-class check_me
-{
-public:
-    check_me() : mnAllocNum(0) {};
-    ~check_me();
-
-    void add( SvxUnoTextRangeBase* pRange );
-    void remove( SvxUnoTextRangeBase* pRange );
-
-    std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > > maRanges;
-    sal_uInt32 mnAllocNum;
-};
-
-void check_me::add( SvxUnoTextRangeBase* pRange )
-{
-    maRanges.push_back( std::pair< sal_uInt32, SvxUnoTextRangeBase* >( mnAllocNum++, pRange ) );
-}
-
-void check_me::remove( SvxUnoTextRangeBase* pRange )
-{
-    std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > >::iterator aIter;
-    for( aIter = maRanges.begin(); aIter != maRanges.end(); ++aIter )
-    {
-        if( pRange == (*aIter).second )
-        {
-            maRanges.erase( aIter );
-            break;
-        }
-    }
-}
-
-check_me::~check_me()
-{
-    if( !maRanges.empty() )
-    {
-        DBG_ERROR("living text range detected!");
-        std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > >::iterator aIter;
-        for( aIter = maRanges.begin(); aIter != maRanges.end(); ++aIter )
-        {
-            sal_Int32 nAllocNum;
-            SvxUnoTextRangeBase* pRange;
-            nAllocNum = (*aIter).first;
-            pRange = (*aIter).second;
-        }
-    }
-}
-
-static check_me gNumRanges;
-#endif
-
 UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
 
 SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw()
 : mpEditSource(NULL) , mpPropSet(_pSet)
 {
-#ifdef DEBUG
-    gNumRanges.add(this);
-#endif
 }
 
 SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
@@ -268,9 +214,6 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv
 
         mpEditSource->addRange( this );
     }
-#ifdef DEBUG
-    gNumRanges.add(this);
-#endif
 }
 
 SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw()
@@ -297,18 +240,10 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) th
 
     if( mpEditSource )
         mpEditSource->addRange( this );
-
-#ifdef DEBUG
-    gNumRanges.add(this);
-#endif
 }
 
 SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
 {
-#ifdef DEBUG
-    gNumRanges.remove(this);
-#endif
-
     if( mpEditSource )
         mpEditSource->removeRange( this );
 


More information about the Libreoffice-commits mailing list