[Libreoffice-commits] .: svtools/source

Joseph Powers jpowers at kemper.freedesktop.org
Sat Aug 6 08:18:54 PDT 2011


 svtools/source/filter/filter.cxx |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 7d00dabf077562cad4e1f4b2209c27b13d3d9487
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Aug 6 07:09:55 2011 -0700

    Replace List with std::vector< GraphicFilter* >

diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index 4566c92..71d3fd9 100644
--- a/svtools/source/filter/filter.cxx
+++ b/svtools/source/filter/filter.cxx
@@ -74,6 +74,7 @@
 #include <comphelper/processfactory.hxx>
 #include <rtl/bootstrap.hxx>
 #include <rtl/instance.hxx>
+#include <vector>
 
 #include "SvFilterOptionsDialog.hxx"
 
@@ -91,7 +92,8 @@
 using namespace ::rtl;
 using namespace ::com::sun::star;
 
-static List*		pFilterHdlList = NULL;
+typedef ::std::vector< GraphicFilter* > FilterList_impl;
+static FilterList_impl* pFilterHdlList = NULL;
 
 static ::osl::Mutex& getListMutex()
 {
@@ -1029,8 +1031,18 @@ GraphicFilter::~GraphicFilter()
 {
     {
         ::osl::MutexGuard aGuard( getListMutex() );
-        pFilterHdlList->Remove( (void*)this );
-        if ( !pFilterHdlList->Count() )
+        for(
+            FilterList_impl::iterator it = pFilterHdlList->begin();
+            it < pFilterHdlList->end();
+            ++it
+        ) {
+            if( *it == this )
+            {
+                pFilterHdlList->erase( it );
+                break;
+            }
+        }
+        if( pFilterHdlList->empty() )
         {
             delete pFilterHdlList, pFilterHdlList = NULL;
             delete pConfig;
@@ -1049,13 +1061,13 @@ void GraphicFilter::ImplInit()
 
         if ( !pFilterHdlList )
         {
-            pFilterHdlList = new List;
+            pFilterHdlList = new FilterList_impl;
             pConfig = new FilterConfigCache( bUseConfig );
         }
         else
-            pConfig = ((GraphicFilter*)pFilterHdlList->First())->pConfig;
+            pConfig = pFilterHdlList->front()->pConfig;
 
-        pFilterHdlList->Insert( (void*)this );
+        pFilterHdlList->push_back( this );
     }
 
     if( bUseConfig )


More information about the Libreoffice-commits mailing list