[Libreoffice-commits] .: 4 commits - binfilter/bf_sc binfilter/bf_sch binfilter/bf_so3 binfilter/bf_xmloff binfilter/inc filter/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri May 20 08:37:00 PDT 2011


 binfilter/bf_sc/source/core/data/sc_dpsave.cxx     |    2 -
 binfilter/bf_sch/source/core/sch_objid.cxx         |    2 -
 binfilter/bf_so3/source/inplace/protocol.cxx       |   24 +++++++-------
 binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx |    4 --
 binfilter/inc/bf_sch/objid.hxx                     |    2 -
 filter/source/config/cache/basecontainer.cxx       |    1 
 filter/source/config/cache/cacheupdatelistener.cxx |   23 ++++++--------
 filter/source/config/cache/cacheupdatelistener.hxx |    9 +++--
 filter/source/config/cache/filtercache.cxx         |   34 ++++++++++++---------
 filter/source/config/cache/filtercache.hxx         |    6 +++
 filter/source/config/cache/lateinitlistener.cxx    |   21 +++++++++---
 filter/source/msfilter/escherex.cxx                |   10 +++---
 filter/source/msfilter/msdffimp.cxx                |   10 +++---
 filter/source/svg/svgreader.cxx                    |    4 +-
 14 files changed, 84 insertions(+), 68 deletions(-)

New commits:
commit 582e2f2fd36d0a8320a09cce916cdbbc0bcfd0da
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 11:18:36 2011 +0100

    WaE: remove warnings that are errors

diff --git a/binfilter/bf_sc/source/core/data/sc_dpsave.cxx b/binfilter/bf_sc/source/core/data/sc_dpsave.cxx
index a7cd3d7..760b509 100644
--- a/binfilter/bf_sc/source/core/data/sc_dpsave.cxx
+++ b/binfilter/bf_sc/source/core/data/sc_dpsave.cxx
@@ -758,7 +758,7 @@ using namespace ::com::sun::star;
 /*N*/ {
 /*N*/ 	//!	multi-header for individual entries
 /*N*/
-/*N*/ 	DBG_ASSERT( aDimList.Count()==0, "ScDPSaveData::Load not empty" );
+/*N*/ 	DBG_ASSERT( aDimList.size()==0, "ScDPSaveData::Load not empty" );
 /*N*/
 /*N*/ 	long nNewCount;
 /*N*/ 	rStream >> nNewCount;
diff --git a/binfilter/bf_sch/source/core/sch_objid.cxx b/binfilter/bf_sch/source/core/sch_objid.cxx
index 4f2b688..49d5705 100644
--- a/binfilter/bf_sch/source/core/sch_objid.cxx
+++ b/binfilter/bf_sch/source/core/sch_objid.cxx
@@ -144,7 +144,7 @@ namespace binfilter {
 
 // this function is for debugging only
 // therefore it is ok to use char* instead of UniString
-/*N*/ char* GetCHOBJIDName( const long id )
+/*N*/ const char* GetCHOBJIDName( const long id )
 /*N*/ {
 /*N*/ 	switch( id )
 /*N*/ 	{
diff --git a/binfilter/bf_so3/source/inplace/protocol.cxx b/binfilter/bf_so3/source/inplace/protocol.cxx
index 8a9e179..dec1faa 100644
--- a/binfilter/bf_so3/source/inplace/protocol.cxx
+++ b/binfilter/bf_so3/source/inplace/protocol.cxx
@@ -752,8 +752,8 @@ void ImplSvEditObjectProtocol::Connected( BOOL bConnectP )
     // nach dem ClientConnect darf alles passieren, bis auf loeschen von this
     if( (bLastActionConnect && !bSvrConnect) || (!bLastActionConnect && bSvrConnect) )
     { // Object verbinden Ich darf verbinden
-        DBG_ASSERT( bConnect && bConnectP && bLastActionConnect && !bSvrConnect
-                    || !bConnect && !bConnectP && !bLastActionConnect && bSvrConnect,
+        DBG_ASSERT( (bConnect && bConnectP && bLastActionConnect && !bSvrConnect)
+                    || (!bConnect && !bConnectP && !bLastActionConnect && bSvrConnect),
                     "connect assert failed" );
         bSvrConnect = bConnect;
         DBG_PROTLOG( "Obj - Connected", bConnectP )
@@ -830,8 +830,8 @@ void ImplSvEditObjectProtocol::Opened( BOOL bOpenP )
     // nach dem ClientOpen darf alles passieren, bis auf loeschen von this
     if( (bLastActionOpen && !bSvrOpen) || (!bLastActionOpen && bSvrOpen) )
     { // Object oeffnen
-        DBG_ASSERT( bOpen && bOpenP && bLastActionOpen && !bSvrOpen
-                    || !bOpen && !bOpenP && !bLastActionOpen && bSvrOpen,
+        DBG_ASSERT( (bOpen && bOpenP && bLastActionOpen && !bSvrOpen)
+                    || (!bOpen && !bOpenP && !bLastActionOpen && bSvrOpen),
                     "open assert failed" );
         bSvrOpen = bOpen;
         DBG_PROTLOG( "Svr - Opened", bOpenP )
@@ -899,8 +899,8 @@ void ImplSvEditObjectProtocol::Embedded( BOOL bEmbedP )
     // nach dem ClientEmbed darf alles passieren, bis auf loeschen von this
     if( (bLastActionEmbed && !bSvrEmbed) || (!bLastActionEmbed && bSvrEmbed) )
     { // Object oeffnen
-        DBG_ASSERT( bEmbed && bEmbedP && bLastActionEmbed && !bSvrEmbed
-                    || !bEmbed && !bEmbedP && !bLastActionEmbed && bSvrEmbed,
+        DBG_ASSERT( (bEmbed && bEmbedP && bLastActionEmbed && !bSvrEmbed)
+                    || (!bEmbed && !bEmbedP && !bLastActionEmbed && bSvrEmbed),
                     "embed assert failed" );
         bSvrEmbed = bEmbed;
         DBG_PROTLOG( "Svr - Embedded", bEmbedP )
@@ -974,8 +974,8 @@ void ImplSvEditObjectProtocol::PlugIn
     // nach dem ClientPlugIn darf alles passieren, bis auf loeschen von this
     if( (bLastActionPlugIn && !bSvrPlugIn) || (!bLastActionPlugIn && bSvrPlugIn) )
     { // Object oeffnen
-        DBG_ASSERT( bPlugIn && bPlugInP && bLastActionPlugIn && !bSvrPlugIn
-                    || !bPlugIn && !bPlugInP && !bLastActionPlugIn && bSvrPlugIn,
+        DBG_ASSERT( (bPlugIn && bPlugInP && bLastActionPlugIn && !bSvrPlugIn)
+                    || (!bPlugIn && !bPlugInP && !bLastActionPlugIn && bSvrPlugIn),
                     "PlugIn assert failed" );
         bSvrPlugIn = bPlugIn;
         DBG_PROTLOG( "Svr - PlugIn", bPlugInP )
@@ -1049,8 +1049,8 @@ void ImplSvEditObjectProtocol::InPlaceActivate( BOOL bIPActiveP )
     // nach dem ClientIPActive darf alles passieren, bis auf loeschen von this
     if( (bLastActionIPActive && !bSvrIPActive) || (!bLastActionIPActive && bSvrIPActive) )
     { // Object oeffnen
-        DBG_ASSERT( bIPActive && bIPActiveP && bLastActionIPActive && !bSvrIPActive
-                    || !bIPActive && !bIPActiveP && !bLastActionIPActive && bSvrIPActive,
+        DBG_ASSERT( (bIPActive && bIPActiveP && bLastActionIPActive && !bSvrIPActive)
+                    || (!bIPActive && !bIPActiveP && !bLastActionIPActive && bSvrIPActive),
                     "inplace assert failed" );
         DBG_ASSERT( aIPObj.Is(), "inplace assert failed" );
         bSvrIPActive = bIPActive;
@@ -1169,8 +1169,8 @@ void ImplSvEditObjectProtocol::UIActivate( BOOL bUIActiveP )
     // nach dem ClientUIActive darf alles passieren, bis auf loeschen von this
     if( (bLastActionUIActive && !bSvrUIActive) || (!bLastActionUIActive && bSvrUIActive) )
     { // Object oeffnen
-        DBG_ASSERT( bUIActive && bUIActiveP && bLastActionUIActive && !bSvrUIActive
-                    || !bUIActive && !bUIActiveP && !bLastActionUIActive && bSvrUIActive,
+        DBG_ASSERT( (bUIActive && bUIActiveP && bLastActionUIActive && !bSvrUIActive)
+                    || (!bUIActive && !bUIActiveP && !bLastActionUIActive && bSvrUIActive),
                     "ui assert failed" );
         DBG_ASSERT( aIPObj.Is(), "inplace assert failed" );
         bSvrUIActive = bUIActive;
diff --git a/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx b/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
index 6bcce1a..c20ba5f 100644
--- a/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
+++ b/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
@@ -2164,12 +2164,8 @@ void XMLTextFieldExport::ProcessValueAndType(
     } 
     else 
     {
-
         // number: value-type=..., value...=..., data-style-name=...
 
-        DBG_ASSERT(bExportValueType || ~bExportValue,
-                   "value w/o value type not supported!");
-
         // take care of illegal formats 
         // (shouldn't happen, but does if document is corrupted)
         if (-1 != nFormatKey)
diff --git a/binfilter/inc/bf_sch/objid.hxx b/binfilter/inc/bf_sch/objid.hxx
index a7db208..7dcda77 100644
--- a/binfilter/inc/bf_sch/objid.hxx
+++ b/binfilter/inc/bf_sch/objid.hxx
@@ -72,7 +72,7 @@ extern SdrObject* GetObjWithId(UINT16 nObjId, const SdrObjList& rObjList,
 
 //Die hier folgenden Funktionen dienen AUSSCHLIESSLICH zu DEBUG-Zwecken
 #if OSL_DEBUG_LEVEL > 0
-extern char *GetCHOBJIDName(const long id);
+extern const char *GetCHOBJIDName(const long id);
 #endif
 
 } //namespace binfilter
commit e342fe6c2f07712e15b509456bf2883ce645c199
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 19 22:26:32 2011 +0100

    adapt for singleton api change

diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 4783d75..6c0fd82 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3725,12 +3725,12 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteSt
                     nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG  : CVT_EMF );
                 else
                 {	// to store a animation, a gif has to be included into the msOG chunk of a png	#I5583#
-                    GraphicFilter*	pFilter = GraphicFilter::GetGraphicFilter();
+                    GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
                     SvMemoryStream  aGIFStream;
                     ByteString		aVersion( "MSOFFICE9.0" );
                     aGIFStream.Write( aVersion.GetBuffer(), aVersion.Len() );
-                    nErrCode = pFilter->ExportGraphic( aGraphic, String(), aGIFStream,
-                        pFilter->GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "GIF" ) ) ), NULL );
+                    nErrCode = rFilter.ExportGraphic( aGraphic, String(), aGIFStream,
+                        rFilter.GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "GIF" ) ) ), NULL );
                     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 );
                     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aAdditionalChunkSequence( 1 );
                     sal_uInt32 nGIFSreamLen = aGIFStream.Tell();
@@ -3745,8 +3745,8 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteSt
                     aFilterProp.Name = String( RTL_CONSTASCII_USTRINGPARAM( "AdditionalChunks" ) );
                     aFilterProp.Value <<= aAdditionalChunkSequence;
                     aFilterData[ 0 ] = aFilterProp;
-                    nErrCode = pFilter->ExportGraphic( aGraphic, String(), aStream,
-                        pFilter->GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "PNG" ) ) ), &aFilterData );
+                    nErrCode = rFilter.ExportGraphic( aGraphic, String(), aStream,
+                        rFilter.GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "PNG" ) ) ), &aFilterData );
                 }
                 if ( nErrCode == ERRCODE_NONE )
                 {
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 31c8582..b998272 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4542,9 +4542,9 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
 
                 if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
                 {
-                    GraphicFilter* pGrfFilter = GraphicFilter::GetGraphicFilter();
-                    aFilterName = pGrfFilter->GetImportFormatName(
-                                    pGrfFilter->GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
+                    GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter();
+                    aFilterName = rGrfFilter.GetImportFormatName(
+                                    rGrfFilter.GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
                 }
 
                 aLinkFileName = aName;
@@ -6933,9 +6933,9 @@ sal_Bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData,
         }
         else
         {	// und unsere feinen Filter darauf loslassen
-            GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
+            GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
             String aEmptyStr;
-            nRes = pGF->ImportGraphic( rData, aEmptyStr, *pGrStream, GRFILTER_FORMAT_DONTKNOW );
+            nRes = rGF.ImportGraphic( rData, aEmptyStr, *pGrStream, GRFILTER_FORMAT_DONTKNOW );
 
             // SJ: I40472, sometimes the aspect ratio (aMtfSize100) does not match and we get scaling problems,
             // then it is better to use the prefsize that is stored within the metafile. Bug #72846# for what the
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 8e7af6f..b149745 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -2318,7 +2318,7 @@ struct ShapeRenderingVisitor
                                         STREAM_READ);
                     sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW;
                     sal_uInt16 pDeterminedFormat = GRFILTER_FORMAT_DONTKNOW;
-                    GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), aSrc ,nFormat,&pDeterminedFormat );
+                    GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), aSrc ,nFormat,&pDeterminedFormat );
 
                     if (pDeterminedFormat == GRFILTER_FORMAT_DONTKNOW)
                     {
@@ -2361,7 +2361,7 @@ struct ShapeRenderingVisitor
                                     if (nStreamLen_)
                                     {
                                         pDest->Seek(0L);
-                                        GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *pDest ,nFormat,&pDeterminedFormat );
+                                        GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), *pDest ,nFormat,&pDeterminedFormat );
                                     }
                                 }
                                 delete pDest;
commit 106eb7e29ca996a25ba5948bf7de5b679cf90170
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 19 16:17:07 2011 +0100

    remove circular dependency to fix leak

diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
index d150595..9b0d33a 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -72,7 +72,6 @@ BaseContainer::BaseContainer()
     , m_lListener  (m_aLock)
 {
     m_rCache->load(FilterCache::E_CONTAINS_STANDARD);
-
     thePerformanceOptimizer::get();
 }
 
diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx
index 886a91e..038b6ca 100644
--- a/filter/source/config/cache/cacheupdatelistener.cxx
+++ b/filter/source/config/cache/cacheupdatelistener.cxx
@@ -53,25 +53,22 @@ namespace css = ::com::sun::star;
 
 
 
-CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR        ,
-                                         const css::uno::Reference< css::uno::XInterface >&            xConfigAccess,
-                                               FilterCache::EItemType                                  eConfigType  )
-    : BaseLock     (             )
-    , m_xSMGR      (xSMGR        )
-    , m_rCache     (             )
-    , m_xConfig    (xConfigAccess)
-    , m_eConfigType(eConfigType  )
+CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
+                                         FilterCache &rFilterCache,
+                                         const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+                                         FilterCache::EItemType eConfigType)
+    : BaseLock()
+    , m_xSMGR(xSMGR)
+    , m_rCache(rFilterCache)
+    , m_xConfig(xConfigAccess)
+    , m_eConfigType(eConfigType)
 {
 }
 
-
-
 CacheUpdateListener::~CacheUpdateListener()
 {
 }
 
-
-
 void CacheUpdateListener::startListening()
 {
     // SAFE ->
@@ -201,7 +198,7 @@ void SAL_CALL  CacheUpdateListener::changesOccurred(const css::util::ChangesEven
         const ::rtl::OUString& sItem = *pIt;
         try
         {
-            m_rCache->refreshItem(eType, sItem);
+            m_rCache.refreshItem(eType, sItem);
         }
         catch(const css::container::NoSuchElementException&)
             {
diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx
index 1aa2577..de3b3af 100644
--- a/filter/source/config/cache/cacheupdatelistener.hxx
+++ b/filter/source/config/cache/cacheupdatelistener.hxx
@@ -67,7 +67,7 @@ class CacheUpdateListener : public BaseLock // must be the first one to guarante
 
         /** @short  reference to the singleton(!) filter cache implementation,
                     which should be updated by this thread. */
-        ::salhelper::SingletonRef< FilterCache > m_rCache;
+        FilterCache &m_rCache;
 
         /** @short  holds the configuration access, where we listen alive. */
         css::uno::Reference< css::uno::XInterface > m_xConfig;
@@ -103,9 +103,10 @@ class CacheUpdateListener : public BaseLock // must be the first one to guarante
             @param  eConfigType
                     specify the type of configuration.
          */
-        CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR        ,
-                            const css::uno::Reference< css::uno::XInterface >&            xConfigAccess,
-                                  FilterCache::EItemType                                  eConfigType  );
+        CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
+                            FilterCache &rFilterCache,
+                            const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+                            FilterCache::EItemType eConfigType);
 
         //---------------------------------------
 
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 5ee046c..a446202 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -94,6 +94,10 @@ FilterCache::FilterCache()
 FilterCache::~FilterCache()
 {
     RTL_LOGFILE_TRACE("} (as96863) FilterCache lifetime");
+    if (m_xTypesChglisteners.is())
+        m_xTypesChglisteners->stopListening();
+    if (m_xFiltersChgListener.is())
+        m_xFiltersChgListener->stopListening();
 }
 
 
@@ -822,15 +826,12 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
 css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider)
     throw(css::uno::Exception)
 {
-    // SAFE ->
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     ::rtl::OUString                              sPath      ;
     css::uno::Reference< css::uno::XInterface >* pConfig = 0;
     css::uno::Reference< css::uno::XInterface >  xOld       ;
     ::rtl::OString                               sRtlLog    ;
-    FilterCache::EItemType                       eItemType( FilterCache::E_TYPE ) ;
-    sal_Bool                                     bStartListening = sal_False;
 
     switch(eProvider)
     {
@@ -840,8 +841,6 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
                 return m_xConfigTypes;
             sPath           = CFGPACKAGE_TD_TYPES;
             pConfig         = &m_xConfigTypes;
-            eItemType       = FilterCache::E_TYPE;
-            bStartListening = sal_True;
             sRtlLog         = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_TYPES)");
         }
         break;
@@ -852,8 +851,6 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
                 return m_xConfigFilters;
             sPath           = CFGPACKAGE_TD_FILTERS;
             pConfig         = &m_xConfigFilters;
-            eItemType       = FilterCache::E_FILTER;
-            bStartListening = sal_True;
             sRtlLog         = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_FILTERS)");
         }
         break;
@@ -864,7 +861,6 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
                 return m_xConfigOthers;
             sPath   = CFGPACKAGE_TD_OTHERS;
             pConfig = &m_xConfigOthers;
-            eItemType = FilterCache::E_TYPE;
             sRtlLog = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_OTHERS)");
         }
         break;
@@ -889,17 +885,27 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
                                            sal_True );  // bLocalesMode
     }
 
+
     // Start listening for changes on that configuration access.
-    // We must not control the lifetime of this listener. Itself
-    // checks, when ist time to die :-)
-    if (bStartListening)
+    switch(eProvider)
     {
-        CacheUpdateListener* pListener = new CacheUpdateListener(m_xSMGR, *pConfig, eItemType);
-        pListener->startListening();
+        case E_PROVIDER_TYPES:
+        {
+            m_xTypesChglisteners.set(new CacheUpdateListener(m_xSMGR, *this, *pConfig, FilterCache::E_TYPE));
+            m_xTypesChglisteners->startListening();
+        }
+        break;
+        case E_PROVIDER_FILTERS:
+        {
+            m_xFiltersChgListener.set(new CacheUpdateListener(m_xSMGR, *this, *pConfig, FilterCache::E_FILTER));
+            m_xFiltersChgListener->startListening();
+        }
+        break;
+        default:
+        break;
     }
 
     return *pConfig;
-    // <- SAFE
 }
 
 
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
index 669b610..bc371e1 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/util/ChangesEvent.hpp>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Any.h>
+#include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 
 //_______________________________________________
@@ -51,6 +52,8 @@
 namespace filter{
     namespace config{
 
+class CacheUpdateListener;
+
 //_______________________________________________
 // definitions
 
@@ -273,6 +276,9 @@ class FilterCache : public BaseLock
         /// readonly acccess to the module configuration of OOo
         css::uno::Reference< css::container::XNameAccess > m_xModuleCfg;
 
+        rtl::Reference< CacheUpdateListener > m_xTypesChglisteners;
+        rtl::Reference< CacheUpdateListener > m_xFiltersChgListener;
+
     //-------------------------------------------
     // interface
 
commit 2b6a26f51c981932d31adfbd4b09c224613369e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 6 21:49:12 2011 +0100

    config leaks: handle cancel from database wizard correctly

diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx
index 6af2d86..387a7ac 100644
--- a/filter/source/config/cache/lateinitlistener.cxx
+++ b/filter/source/config/cache/lateinitlistener.cxx
@@ -78,10 +78,14 @@ LateInitListener::~LateInitListener()
 void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aEvent)
     throw(css::uno::RuntimeException)
 {
-    // wait for events, which indicates finished open of the first document
+    // wait for events which either
+    // a) indicate completed open of the first document in which case launch thread
+    // b) indicate close of application without any documents opened, in which case skip launching thread but drop references break cyclic dependencies in
+    // case of e.g. cancel from open/new database wizard or impress wizard
     if (
-        (aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnNew")) ) ||
-        (aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnLoad")))
+        (aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnNew"))) ||
+        (aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnLoad"))) ||
+        (aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnCloseApp")))
        )
     {
         // this thread must be started one times only ...
@@ -106,8 +110,11 @@ void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aE
         aLock.clear();
         // <- SAFE
 
-        LateInitThread* pThread = new LateInitThread();
-        pThread->create();
+        if (!aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnCloseApp")))
+        {
+            LateInitThread* pThread = new LateInitThread();
+            pThread->create();
+        }
     }
 }
 
@@ -124,6 +131,10 @@ void SAL_CALL LateInitListener::disposing(const css::lang::EventObject& /* aEven
 
     // SAFE ->
     ::osl::ResettableMutexGuard aLock(m_aLock);
+    if ( !m_xBroadcaster.is() )
+        return;
+
+    m_xBroadcaster->removeEventListener(static_cast< css::document::XEventListener* >(this));
     m_xBroadcaster.clear();
     aLock.clear();
     // <- SAFE


More information about the Libreoffice-commits mailing list