[Libreoffice-commits] .: 31 commits - comphelper/inc comphelper/Library_comphelp.mk comphelper/Package_inc.mk comphelper/source i18npool/inc i18npool/source padmin/source svtools/inc svtools/source unotools/inc unotools/source vcl/inc vcl/source vcl/unx

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


 comphelper/Library_comphelp.mk                         |    1 
 comphelper/Package_inc.mk                              |    2 
 comphelper/inc/comphelper/componentmodule.hxx          |   38 ---
 comphelper/inc/comphelper/legacysingletonfactory.hxx   |   75 ------
 comphelper/inc/comphelper/scoped_disposing_ptr.hxx     |  178 +++++++++++++++
 comphelper/inc/comphelper/types.hxx                    |    2 
 comphelper/source/misc/legacysingletonfactory.cxx      |  200 -----------------
 i18npool/inc/i18npool/lang.h                           |    1 
 i18npool/source/isolang/isolang.cxx                    |    2 
 padmin/source/pamain.cxx                               |   16 +
 svtools/inc/svtools/filter.hxx                         |    2 
 svtools/inc/svtools/htmlcfg.hxx                        |    6 
 svtools/source/config/htmlcfg.cxx                      |   14 -
 svtools/source/config/menuoptions.cxx                  |    4 
 svtools/source/filter.vcl/filter/FilterConfigCache.cxx |    8 
 svtools/source/filter.vcl/filter/filter.cxx            |   29 +-
 svtools/source/graphic/provider.cxx                    |   12 -
 svtools/source/misc/ehdl.cxx                           |    3 
 svtools/source/misc/embedhlp.cxx                       |    8 
 svtools/source/misc/imagemgr.cxx                       |   25 +-
 svtools/source/misc/transfer.cxx                       |   15 -
 unotools/inc/unotools/bootstrap.hxx                    |    2 
 unotools/inc/unotools/componentresmodule.hxx           |   14 -
 unotools/inc/unotools/configitem.hxx                   |    2 
 unotools/inc/unotools/fontcfg.hxx                      |    4 
 unotools/source/config/bootstrap.cxx                   |   68 ++---
 unotools/source/config/configitem.cxx                  |    2 
 unotools/source/config/configmgr.cxx                   |   10 
 unotools/source/config/fontcfg.cxx                     |   18 -
 unotools/source/misc/fontdefs.cxx                      |    2 
 vcl/inc/vcl/ppdparser.hxx                              |    4 
 vcl/source/app/settings.cxx                            |    2 
 vcl/source/gdi/font.cxx                                |    6 
 vcl/source/gdi/outdev3.cxx                             |   14 -
 vcl/source/window/window.cxx                           |    2 
 vcl/unx/source/dtrans/X11_clipboard.cxx                |    2 
 vcl/unx/source/dtrans/X11_selection.cxx                |   43 +--
 vcl/unx/source/dtrans/X11_selection.hxx                |    1 
 vcl/unx/source/dtrans/X11_transferable.cxx             |    2 
 vcl/unx/source/dtrans/X11_transferable.hxx             |    3 
 vcl/unx/source/printer/jobdata.cxx                     |    7 
 vcl/unx/source/printer/ppdparser.cxx                   |   10 
 42 files changed, 359 insertions(+), 500 deletions(-)

New commits:
commit de2dcc891cbbf80caffa990abefe3b439ff286e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 09:36:43 2011 +0100

    drop extra fprintfs

diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index 60a01d7..ba8e7f6 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -1017,7 +1017,6 @@ GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
     bUseConfig	      ( bConfig ),
     nExpGraphHint     ( 0 )
 {
-    fprintf(stderr, "GraphicFilter::GraphicFilter ctor %p\n", this);
     ImplInit();
 }
 
@@ -1025,7 +1024,6 @@ GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
 
 GraphicFilter::~GraphicFilter()
 {
-    fprintf(stderr, "GraphicFilter::GraphicFilter dtor %p\n", this);
     {
         ::osl::MutexGuard aGuard( getListMutex() );
         pFilterHdlList->Remove( (void*)this );
@@ -1036,7 +1034,6 @@ GraphicFilter::~GraphicFilter()
         }
     }
 
-
     delete pErrorEx;
 }
 
commit 7a333ba9af96f314eb970a42434837649c1a133a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 09:18:48 2011 +0100

    add a template for dtoring on desktop::termination

diff --git a/comphelper/inc/comphelper/scoped_disposing_ptr.hxx b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx
index 5e63f1d..7278126 100644
--- a/comphelper/inc/comphelper/scoped_disposing_ptr.hxx
+++ b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx
@@ -33,25 +33,28 @@
 #include <boost/scoped_ptr.hpp>
 
 #include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
 
-#include <stdio.h>
+// for locking SolarMutex: svapp + mutex
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
 
 namespace comphelper
 {
-//Similar to boost::scoped_ptr, except additionally releases the ptr on rComponent::disposing
+//Similar to boost::scoped_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported
 template<class T> class scoped_disposing_ptr : private boost::noncopyable
 {
 private:
     boost::scoped_ptr<T> m_aItem;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener> m_xDisposingListener;
+    ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> m_xTerminateListener;
 public:
     scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
         : m_aItem(p)
     {
-        m_xDisposingListener = new DisposingListener(rComponent, m_aItem);
+        m_xTerminateListener = new TerminateListener(rComponent, *this);
     }
 
-    void reset(T * p = 0)
+    virtual void reset(T * p = 0)
     {
         m_aItem.reset(p);
     }
@@ -81,42 +84,91 @@ public:
         reset();
     }
 private:
-    class DisposingListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+    class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
     {
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent;
-        boost::scoped_ptr<T>& m_rItem;
+        scoped_disposing_ptr<T>& m_rItem;
     public:
-        DisposingListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent,
-            boost::scoped_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem)
+        TerminateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent,
+            scoped_disposing_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem)
         {
             if (m_xComponent.is())
-                m_xComponent->addEventListener( this );
+            {
+                ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+                if (xDesktop.is())
+                    xDesktop->addTerminateListener(this);
+                else
+                    m_xComponent->addEventListener(this);
+            }
         }
 
-        ~DisposingListener()
+        ~TerminateListener()
         {
             if ( m_xComponent.is() )
-                m_xComponent->removeEventListener( this );
+            {
+                ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+                if (xDesktop.is())
+                    xDesktop->removeTerminateListener(this);
+                else
+                    m_xComponent->removeEventListener(this);
+            }
         }
 
     private:
         // XEventListener
-        virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & rEvt )
+        virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvt )
             throw (::com::sun::star::uno::RuntimeException)
         {
             bool shutDown = (rEvt.Source == m_xComponent);
 
-            if ( shutDown && m_xComponent.is() )
+            if (shutDown && m_xComponent.is())
             {
-                m_xComponent->removeEventListener( this );
+                ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+                if (xDesktop.is())
+                    xDesktop->removeTerminateListener(this);
+                else
+                    m_xComponent->removeEventListener(this);
                 m_xComponent.clear();
             }
 
-            if ( shutDown )
+            if (shutDown)
                m_rItem.reset();
         }
-    };
+
+        // XTerminateListener
+        virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& )
+            throw(::com::sun::star::frame::TerminationVetoException,
+                  ::com::sun::star::uno::RuntimeException)
+        {
+        }
+
+        virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEvt )
+            throw (::com::sun::star::uno::RuntimeException)
+        {
+            disposing(rEvt);
+        }
+   };
+};
+
+//Something like an OutputDevice requires the SolarMutex to be taken before use
+//for threadsafety. The user can ensure this, except in the case of its dtor
+//being called from reset due to a terminate on the XComponent being called
+//from an aribitrary thread
+template<class T> class scoped_disposing_solar_mutex_reset_ptr
+    : public scoped_disposing_ptr<T>
+{
+public:
+    scoped_disposing_solar_mutex_reset_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+        : scoped_disposing_ptr<T>(rComponent, p)
+    {
+    }
+
+    virtual void reset(T * p = 0)
+    {
+        SolarMutexGuard aGuard;
+        scoped_disposing_ptr<T>::reset(p);
+    }
 };
 
 }
commit ea3a8bb6aa014e982597382ef07ac99abe71b3fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 09:17:02 2011 +0100

    make this a well-behaved singleton

diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx
index 256e934..067c92a 100644
--- a/svtools/inc/svtools/filter.hxx
+++ b/svtools/inc/svtools/filter.hxx
@@ -360,7 +360,7 @@ public:
     void					ResetLastError();
 
     const Link      GetFilterCallback() const;
-    static 			GraphicFilter* GetGraphicFilter();
+    static GraphicFilter& GetGraphicFilter();
     static int 		LoadGraphic( const String& rPath, const String& rFilter,
                      Graphic& rGraphic,
                      GraphicFilter* pFilter = NULL,
diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
index 308a858..dd04870 100644
--- a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
+++ b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
@@ -107,7 +107,7 @@ sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUSt
             if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) )
                 bIsPixelFormat = sal_True;
         }
-        rtl::OUString sTemp(OUString(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?") )));
+        rtl::OUString sTemp(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?")));
         sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?'));
         sFilterName = sTemp.replaceAt(nIndex, 1, sFilterName);
     }
@@ -348,7 +348,6 @@ FilterConfigCache::FilterConfigCache( sal_Bool bConfig ) :
 
 FilterConfigCache::~FilterConfigCache()
 {
-
 }
 
 String FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat )
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index 14832b2..60a01d7 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -110,8 +110,6 @@ static ::osl::Mutex& getListMutex()
     return s_aListProtection;
 }
 
-static GraphicFilter* pGraphicFilter=0;
-
 // -------------------------
 // - ImpFilterOutputStream -
 // -------------------------
@@ -1019,6 +1017,7 @@ GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
     bUseConfig	      ( bConfig ),
     nExpGraphHint     ( 0 )
 {
+    fprintf(stderr, "GraphicFilter::GraphicFilter ctor %p\n", this);
     ImplInit();
 }
 
@@ -1026,6 +1025,7 @@ GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
 
 GraphicFilter::~GraphicFilter()
 {
+    fprintf(stderr, "GraphicFilter::GraphicFilter dtor %p\n", this);
     {
         ::osl::MutexGuard aGuard( getListMutex() );
         pFilterHdlList->Remove( (void*)this );
@@ -2144,16 +2144,24 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData )
     return nRet;
 }
 
-// ------------------------------------------------------------------------
-
-GraphicFilter* GraphicFilter::GetGraphicFilter()
+namespace
 {
-    if( !pGraphicFilter )
+    class StandardGraphicFilter
     {
-        pGraphicFilter = new GraphicFilter;
-        pGraphicFilter->GetImportFormatCount();
-    }
-    return pGraphicFilter;
+    public:
+        StandardGraphicFilter()
+        {
+            m_aFilter.GetImportFormatCount();
+        }
+        GraphicFilter m_aFilter;
+    };
+
+    class theGraphicFilter : public rtl::Static<StandardGraphicFilter, theGraphicFilter> {};
+}
+
+GraphicFilter& GraphicFilter::GetGraphicFilter()
+{
+    return theGraphicFilter::get().m_aFilter;
 }
 
 int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName,
@@ -2161,7 +2169,7 @@ int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName,
                  sal_uInt16* pDeterminedFormat )
 {
     if ( !pFilter )
-        pFilter = GetGraphicFilter();
+        pFilter = &GetGraphicFilter();
 
     const sal_uInt16 nFilter = rFilterName.Len() && pFilter->GetImportFormatCount()
                     ? pFilter->GetImportFormatNumber( rFilterName )
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 83058d5..f3e370f 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -437,9 +437,9 @@ void EmbeddedObjectRef::GetReplacement( sal_Bool bUpdate )
     SvStream* pGraphicStream = GetGraphicStream( bUpdate );
     if ( pGraphicStream )
     {
-        GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
+        GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
         if( mpImp->pGraphic )
-            pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+            rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
         mpImp->mnGraphicVersion++;
         delete pGraphicStream;
     }
@@ -530,8 +530,8 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
 
     if ( pGraphicStream )
     {
-        GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
-        pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+        GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
+        rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
         mpImp->mnGraphicVersion++;
 
         if ( mpImp->pContainer )
commit 3be557ecf8762fa664c1be90eb1392b6aa66c6fd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 10:14:35 2011 +0100

    fix merge conflicts

diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 44c053d..9f5e471 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -498,13 +498,12 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
 
     if( pIStm )
     {
-        ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter();
+        ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter();
 
-        if( pFilter )
         {
             ::Graphic aVCLGraphic;
 
-            if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) &&
+            if( ( rFilter.ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) &&
                 ( aVCLGraphic.GetType() != GRAPHIC_NONE ) )
             {
                 ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
@@ -826,9 +825,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
 
         if( pFilterShortName )
         {
-            ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter();
+            ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter();
 
-            if( pFilter )
             {
                 const uno::Reference< XInterface > 	xIFace( rxGraphic, uno::UNO_QUERY );
                 const ::Graphic* 					pGraphic = ::unographic::Graphic::getImplementation( xIFace );
@@ -846,8 +844,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
                         aMemStrm << aGraphic;
                     else
                     {
-                        pFilter->ExportGraphic( aGraphic, aPath, aMemStrm,
-                                                pFilter->GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ),
+                        rFilter.ExportGraphic( aGraphic, aPath, aMemStrm,
+                                                rFilter.GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ),
                                                     ( aFilterDataSeq.getLength() ? &aFilterDataSeq : NULL ) );
                     }
                     aMemStrm.Seek( STREAM_SEEK_TO_END );
commit 176fa8ec79b41ef34ca1f98620f4a5f8f20642b5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 09:15:21 2011 +0100

    dump offending config entry names

diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 7574228..ec31daf 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -47,6 +47,8 @@
 
 #include <list>
 
+#include <stdio.h>
+
 //-----------------------------------------------------------------------------
 
 using namespace utl;
@@ -120,10 +122,7 @@ ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) :
 ConfigManager::~ConfigManager()
 {
     //check list content -> should be empty!
-#if OSL_DEBUG_LEVEL > 1
-    // I think this is a pointless assertion, the code seems to cope
-    // fine with it being empty, no need to crash in a dbglevel=1
-    // build.
+#if OSL_DEBUG_LEVEL > 0
     OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive");
 #endif
     if(!pMgrImpl->aItemList.empty())
@@ -132,6 +131,9 @@ ConfigManager::~ConfigManager()
         for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
         {
             ConfigItemListEntry_Impl& rEntry = *aListIter;
+#if OSL_DEBUG_LEVEL > 0
+            fprintf(stderr, "Dangling config item of %s\n", rtl::OUStringToOString(rEntry.pConfigItem->GetSubTreeName(), RTL_TEXTENCODING_UTF8).getStr());
+#endif
             rEntry.pConfigItem->ReleaseConfigMgr();
         }
         pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end());
commit 4bbe61642602fac7928d2e50b01814bc59edd14c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 09:12:44 2011 +0100

    tweak all this to be non-leaky

diff --git a/vcl/unx/source/dtrans/X11_clipboard.cxx b/vcl/unx/source/dtrans/X11_clipboard.cxx
index 279fb89..78ca902 100644
--- a/vcl/unx/source/dtrans/X11_clipboard.cxx
+++ b/vcl/unx/source/dtrans/X11_clipboard.cxx
@@ -155,7 +155,7 @@ Reference< XTransferable > SAL_CALL X11Clipboard::getContents()
     MutexGuard aGuard(m_rSelectionManager.getMutex());
 
     if( ! m_aContents.is() )
-        m_aContents = new X11Transferable( SelectionManager::get(), static_cast< OWeakObject* >(this), m_aSelection );
+        m_aContents = new X11Transferable( SelectionManager::get(), m_aSelection );
     return m_aContents;
 }
 
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 4a4e9a4..b9278e1 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -463,7 +463,7 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
                 // just interested in SelectionClear/Notify/Request and PropertyChange
                 XSelectInput( m_pDisplay, m_aWindow, PropertyChangeMask );
                 // create the transferable for Drag operations
-                m_xDropTransferable = new X11Transferable( *this, static_cast< OWeakObject* >(this), m_nXdndSelection );
+                m_xDropTransferable = new X11Transferable( *this, m_nXdndSelection );
                 registerHandler( m_nXdndSelection, *this );
 
                 m_aThread = osl_createSuspendedThread( call_SelectionManager_run, this );
@@ -518,12 +518,6 @@ SelectionManager::~SelectionManager()
     fprintf( stderr, "shutting down SelectionManager\n" );
 #endif
 
-    if( m_xDisplayConnection.is() )
-    {
-        m_xDisplayConnection->removeEventHandler( Any(), this );
-        m_xDisplayConnection.clear();
-    }
-
     if( m_pDisplay )
     {
         deregisterHandler( m_nXdndSelection );
@@ -3773,9 +3767,9 @@ void SelectionManager::run( void* pThis )
     css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
     if( xFact.is() )
     {
-        css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
-        if( xDesktop.is() )
-            xDesktop->addTerminateListener(This);
+        This->m_xDesktop.set(xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY);
+        if (This->m_xDesktop.is())
+            This->m_xDesktop->addTerminateListener(This);
     }
 
     while( osl_scheduleThread(This->m_aThread) )
@@ -3820,12 +3814,22 @@ void SelectionManager::run( void* pThis )
 
 void SelectionManager::shutdown() throw()
 {
+    #if OSL_DEBUG_LEVEL > 1
+    fprintf( stderr, "SelectionManager got app termination event\n" );
+    #endif
+
     osl::ResettableMutexGuard aGuard(m_aMutex);
+
     if( m_bShutDown )
-    {
         return;
-    }
     m_bShutDown = true;
+
+    if ( m_xDesktop.is() )
+        m_xDesktop->removeTerminateListener(this);
+
+    if( m_xDisplayConnection.is() )
+        m_xDisplayConnection->removeEventHandler(Any(), this);
+
     // stop dispatching
     if( m_aThread )
     {
@@ -3856,8 +3860,9 @@ void SelectionManager::shutdown() throw()
         m_aThread = NULL;
         aGuard.reset();
     }
-    m_xDisplayConnection->removeEventHandler( Any(), this );
+    m_xDesktop.clear();
     m_xDisplayConnection.clear();
+    m_xDropTransferable.clear();
 }
 
 // ------------------------------------------------------------------------
@@ -3897,9 +3902,11 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw()
     return sal_True;
 }
 
-void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& )
+void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& rEvt )
     throw( ::com::sun::star::uno::RuntimeException )
 {
+    if (rEvt.Source == m_xDesktop || rEvt.Source == m_xDisplayConnection)
+        shutdown();
 }
 
 void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::EventObject& )
@@ -3915,13 +3922,7 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::
 void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent )
     throw( ::com::sun::star::uno::RuntimeException )
 {
-    css::uno::Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY );
-    if( xDesktop.is() == sal_True )
-        xDesktop->removeTerminateListener( this );
-    #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SelectionManager got app termination event\n" );
-    #endif
-    shutdown();
+    disposing(rEvent);
 }
 
 // ------------------------------------------------------------------------
diff --git a/vcl/unx/source/dtrans/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx
index 116c932..997ca71 100644
--- a/vcl/unx/source/dtrans/X11_selection.hxx
+++ b/vcl/unx/source/dtrans/X11_selection.hxx
@@ -259,6 +259,7 @@ namespace x11 {
         oslThread					m_aDragExecuteThread;
         ::osl::Condition			m_aDragRunning;
         XLIB_Window					m_aWindow;
+        com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop;
         com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection >
                                     m_xDisplayConnection;
         com::sun::star::uno::Reference< com::sun::star::script::XInvocation >
diff --git a/vcl/unx/source/dtrans/X11_transferable.cxx b/vcl/unx/source/dtrans/X11_transferable.cxx
index 946144d..3ef1c03 100644
--- a/vcl/unx/source/dtrans/X11_transferable.cxx
+++ b/vcl/unx/source/dtrans/X11_transferable.cxx
@@ -51,11 +51,9 @@ using ::rtl::OUString;
 
 X11Transferable::X11Transferable(
     SelectionManager& rManager,
-    const Reference< XInterface >& xCreator,
     Atom selection
     ) :
         m_rManager( rManager ),
-        m_xCreator( xCreator ),
         m_aSelection( selection )
 {
 }
diff --git a/vcl/unx/source/dtrans/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx
index fcd7d40..5eabba4 100644
--- a/vcl/unx/source/dtrans/X11_transferable.hxx
+++ b/vcl/unx/source/dtrans/X11_transferable.hxx
@@ -43,10 +43,9 @@ namespace x11 {
         ::osl::Mutex m_aMutex;
     
         SelectionManager&				m_rManager;
-        com::sun::star::uno::Reference< XInterface >			m_xCreator;
         Atom				m_aSelection;	
     public:
-        X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None );
+        X11Transferable( SelectionManager& rManager, Atom selection = None );
         virtual ~X11Transferable();
 
         /*
commit 860ab8c65275438d64d58dda26fae80510a04531
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 17 15:59:44 2011 +0100

    pointless non-NULL check

diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index c365912..e939548 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -175,8 +175,7 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l
 
 SfxErrorHandler::~SfxErrorHandler()
 {
-    if( pFreeMgr )
-        delete pFreeMgr;
+    delete pFreeMgr;
 }
 
 //-------------------------------------------------------------------------
commit 55e19a47c53db34ea658bc29dbf8db4a2acbf393
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 23:18:20 2011 +0100

    valgrind: release this memory eventually

diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index b5a9c26..1cdcb90 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -54,6 +54,7 @@
 #include <svtools/imagemgr.hrc>
 #include <svtools/svtdata.hxx>
 #include <osl/mutex.hxx>
+#include <boost/scoped_ptr.hpp>
 
 // globals *******************************************************************
 
@@ -537,36 +538,34 @@ static Image GetImageFromList_Impl( sal_uInt16 nImageId, sal_Bool bBig )
 
     ImageList* pList = NULL;
 
-    static ImageList* _pSmallImageList = NULL;
-    static ImageList* _pBigImageList = NULL;
+    static boost::scoped_ptr<ImageList> xSmallImageList;
+    static boost::scoped_ptr<ImageList> xBigImageList;
     static sal_uLong nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle();
 
     // If the style has been changed, throw away our cache of the older images
     if ( nStyle != Application::GetSettings().GetStyleSettings().GetSymbolsStyle() )
     {
-        delete _pSmallImageList, _pSmallImageList = NULL;
-        delete _pBigImageList, _pBigImageList = NULL;
+        xSmallImageList.reset();
+        xBigImageList.reset();
         nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle();
     }
 
     if ( bBig )
     {
-        if ( !_pBigImageList )
-            _pBigImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_BIG ) );
-        pList = _pBigImageList;
+        if ( !xBigImageList )
+            xBigImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_BIG)));
+        pList = xBigImageList.get();
     }
     else
     {
-        if ( !_pSmallImageList )
-            _pSmallImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_SMALL ) );
-        pList = _pSmallImageList;
+        if ( !xSmallImageList )
+            xSmallImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_SMALL)));
+        pList = xSmallImageList.get();
     }
 
     if ( pList->HasImageAtPos( nImageId ) )
         return pList->GetImage( nImageId );
-    else
-        return Image();
-//      return GetOfficeImageFromList_Impl( nImageId, bBig );
+    return Image();
 }
 
 String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObject, sal_Bool bDetectFolder )
commit 3427887770f3a6a9743c3708acc5984db2c59a0e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 22:33:05 2011 +0100

    adjust for non leaky singleton

diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 2250cf2..b8a6db8 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -544,7 +544,7 @@ void ImplStyleData::SetStandardStyles()
     Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
     aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
     aStdFont.SetWeight( WEIGHT_NORMAL );
-    aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
+    aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
     maAppFont                   = aStdFont;
     maHelpFont                  = aStdFont;
     maMenuFont                  = aStdFont;
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index b29c980..3eb1931 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -168,7 +168,7 @@ void Impl_Font::AskConfig()
     mbConfigLookup = true;
 
     // prepare the FontSubst configuration lookup
-    const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get();
+    const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get();
 
     String      aShortName;
     String      aFamilyName;
@@ -181,11 +181,11 @@ void Impl_Font::AskConfig()
         aShortName, aFamilyName, eWeight, eWidthType, nType );
 
     // lookup the font name in the configuration
-    const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName );
+    const utl::FontNameAttr* pFontAttr = rFontSubst.getSubstInfo( aMapName );
 
     // if the direct lookup failed try again with an alias name
     if ( !pFontAttr && (aShortName != aMapName) )
-        pFontAttr = pFontSubst->getSubstInfo( aShortName );
+        pFontAttr = rFontSubst.getSubstInfo( aShortName );
 
     if( pFontAttr )
     {
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 0f1c30b..84738f3 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -512,7 +512,7 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang,
         MsLangId::convertLanguageToLocale( eLang, aLocale );
     }
 
-    utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get();
+    utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
     String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback
     String aDefault = rDefaults.getDefaultFont( aLocale, nType );
     if( aDefault.Len() )
@@ -1665,7 +1665,7 @@ void ImplDevFontList::InitMatchData() const
     mbMatchData = true;
 
     // calculate MatchData for all entries
-    const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get();
+    const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get();
 
     DevFontList::const_iterator it = maDevFontList.begin();
     for(; it != maDevFontList.end(); ++it )
@@ -1681,7 +1681,7 @@ void ImplDevFontList::InitMatchData() const
 ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const
 {
     // get the default font for a specified locale
-    const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get();
+    const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get();
     const String aDefault = rDefaults.getUserInterfaceFont( rLocale );
     ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault );
     if( pFontData )
@@ -2057,7 +2057,7 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const
 {
     // try to find one of the default fonts of the
     // UNICODE, SANSSERIF, SERIF or FIXED default font lists
-    const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get();
+    const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get();
     com::sun::star::lang::Locale aLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() );
     String aFontname = rDefaults.getDefaultFont( aLocale, DEFAULTFONT_SANS_UNICODE );
     ImplDevFontListData* pFoundData = ImplFindByTokenNames( aFontname );
@@ -2591,7 +2591,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
     {
         // get fallback info using FontSubstConfiguration and
         // the target name, it's shortened name and family name in that order
-        const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get();
+        const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get();
         pFontAttr = rFontSubst.getSubstInfo( aSearchName );
         if ( !pFontAttr && (aSearchShortName != aSearchName) )
             pFontAttr = rFontSubst.getSubstInfo( aSearchShortName );
@@ -2611,7 +2611,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
     if( rFSD.IsSymbolFont() )
     {
         com::sun::star::lang::Locale aDefaultLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() );
-        aSearchName = DefaultFontConfiguration::get()->getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL );
+        aSearchName = DefaultFontConfiguration::get().getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL );
         ImplDevFontListData* pFoundData = ImplFindByTokenNames( aSearchName );
         if( pFoundData )
             return pFoundData;
@@ -2647,7 +2647,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
 
         // get fallback info using FontSubstConfiguration and
         // the target name, it's shortened name and family name in that order
-        const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get();
+        const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get();
         const FontNameAttr* pTempFontAttr = rFontSubst.getSubstInfo( aSearchName );
         if ( !pTempFontAttr && (aTempShortName != aSearchName) )
             pTempFontAttr = rFontSubst.getSubstInfo( aTempShortName );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d217360..47e0d7c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -321,7 +321,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
     if ( !bUseSystemFont )
     {
         ImplInitFontList();
-        String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() );
+        String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILocale() );
         xub_StrLen nIndex = 0;
         while( nIndex != STRING_NOTFOUND )
         {
commit af1345ea0871be49f990d09963e3af945c96edca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 22:26:06 2011 +0100

    non leaky singleton

diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
index 37faf05..75b23a4 100644
--- a/unotools/inc/unotools/fontcfg.hxx
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -97,7 +97,7 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
     public:
     ~DefaultFontConfiguration();
     
-    static DefaultFontConfiguration* get();
+    static DefaultFontConfiguration& get();
     
     rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const;
     rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const;    
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 531c345..e8749cb 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -59,8 +59,6 @@ using namespace com::sun::star::container;
 
 using ::rtl::OUString;
 
-static DefaultFontConfiguration* mpDefaultFontConfiguration = 0;
-
 /*
  * DefaultFontConfiguration
  */
@@ -98,11 +96,10 @@ static const char* getKeyType( int nKeyType )
     }
 }
 
-DefaultFontConfiguration* DefaultFontConfiguration::get()
+DefaultFontConfiguration& DefaultFontConfiguration::get()
 {
-    if( !mpDefaultFontConfiguration )
-        mpDefaultFontConfiguration = new DefaultFontConfiguration();
-    return mpDefaultFontConfiguration;
+    static DefaultFontConfiguration aDefaultFontConfiguration;
+    return aDefaultFontConfiguration;
 }
 
 DefaultFontConfiguration::DefaultFontConfiguration()
commit 856af398f3a32bd620c4c8937aa0e1d8be8ed823
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 22:24:54 2011 +0100

    non leaky singleton

diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
index 54827b1..37faf05 100644
--- a/unotools/inc/unotools/fontcfg.hxx
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -211,7 +211,7 @@ private:
 public:
     ~FontSubstConfiguration();
 
-    static FontSubstConfiguration* get();
+    static FontSubstConfiguration& get();
 
     const FontNameAttr* getSubstInfo(
                                      const String& rFontName,
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index d44dad7..531c345 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -61,8 +61,6 @@ using ::rtl::OUString;
 
 static DefaultFontConfiguration* mpDefaultFontConfiguration = 0;
 
-static FontSubstConfiguration* mpFontSubstConfiguration = 0;
-
 /*
  * DefaultFontConfiguration
  */
@@ -375,11 +373,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
  *  FontSubstConfigItem::get
  */
 
-FontSubstConfiguration* FontSubstConfiguration::get()
+FontSubstConfiguration& FontSubstConfiguration::get()
 {
-    if( !mpFontSubstConfiguration )
-        mpFontSubstConfiguration = new FontSubstConfiguration();
-    return mpFontSubstConfiguration;
+    static FontSubstConfiguration aFontSubstConfiguration;
+    return aFontSubstConfiguration;
 }
 
 /*
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index 62334f1..186dfbb 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -542,7 +542,7 @@ String GetSubsFontName( const String& rName, sal_uLong nFlags )
       ||  aOrgName.EqualsAscii( "opensymbol" ) ) )
         return aName;
 
-    const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get()->getSubstInfo( aOrgName );
+    const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName );
     if ( pAttr )
     {
         for( int i = 0; i < 3; i++ )
commit 468e876f1051179b3edf6685eaf561191e15b18a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 21:56:16 2011 +0100

    reimplement this using standard singleton pattern

diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index 16da1fb..059c841 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -41,6 +41,7 @@
 #include <osl/diagnose.h>
 // ---------------------------------------------------------------------------------------
 #include <rtl/bootstrap.hxx>
+#include <rtl/instance.hxx>
 #include <osl/process.h> // for osl_getExecutableFile
 #include "tools/getprocessworkingdir.hxx"
 
@@ -145,25 +146,19 @@ namespace utl
         bool initUserInstallationData(rtl::Bootstrap& _rData);
     };
 
-    static Bootstrap::Impl* s_pData = NULL;
+    namespace
+    {
+        class theImpl : public rtl::Static<Bootstrap::Impl, theImpl> {};
+    }
 
     const Bootstrap::Impl& Bootstrap::data()
     {
-        if (!s_pData)
-        {
-            using namespace osl;
-            MutexGuard aGuard( Mutex::getGlobalMutex() );
-            s_pData = new Impl;
-        }
-        return *s_pData;
+        return theImpl::get();
     }
 
     void Bootstrap::reloadData()
     {
-        if (s_pData != NULL) {
-            delete s_pData;
-            s_pData = NULL;
-        }
+        theImpl::get().initialize();
     }
 
 // ---------------------------------------------------------------------------------------
commit 89e41dc46d9103047868a74743ba2ef33a024066
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 21:51:36 2011 +0100

    set initialize result as part of initialize

diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index fc21a87..16da1fb 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -129,10 +129,10 @@ namespace utl
     public: // construction and initialization
         Impl() : m_aImplName(makeImplName())
         {
-            status_ = initialize();
+            initialize();
         }
 
-        Status initialize();
+        void initialize();
 
         // access helper
         OUString getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const;
@@ -841,19 +841,17 @@ bool Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap& _rData)
 }
 // ---------------------------------------------------------------------------------------
 
-Bootstrap::Status Bootstrap::Impl::initialize()
+void Bootstrap::Impl::initialize()
 {
-    Bootstrap::Status result;
-
     rtl::Bootstrap aData( m_aImplName );
 
     if (!initBaseInstallationData(aData))
     {
-        result = INVALID_BASE_INSTALL;
+        status_ = INVALID_BASE_INSTALL;
     }
     else if (!initUserInstallationData(aData))
     {
-        result = INVALID_USER_INSTALL;
+        status_ = INVALID_USER_INSTALL;
 
         if (aUserInstall_.status >= DATA_MISSING)
         {
@@ -861,12 +859,12 @@ Bootstrap::Status Bootstrap::Impl::initialize()
             {
             case PATH_EXISTS:
             case PATH_VALID:
-                result = MISSING_USER_INSTALL;
+                status_ = MISSING_USER_INSTALL;
                 break;
 
             case DATA_INVALID:
             case DATA_MISSING:
-                result = INVALID_BASE_INSTALL;
+                status_ = INVALID_BASE_INSTALL;
                 break;
             default:
                 break;
@@ -875,9 +873,8 @@ Bootstrap::Status Bootstrap::Impl::initialize()
     }
     else
     {
-        result = DATA_OK;
+        status_ = DATA_OK;
     }
-    return result;
 }
 // ---------------------------------------------------------------------------------------
 
commit 5ad4c03756b44c766af545d4a499a8405d2c3369
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 21:47:32 2011 +0100

    move argument generation into ctor

diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx
index 9f29485..808e293 100644
--- a/unotools/inc/unotools/bootstrap.hxx
+++ b/unotools/inc/unotools/bootstrap.hxx
@@ -131,7 +131,7 @@ namespace utl
     public:
         // singleton impl-class
         class Impl;
-        static Impl const& data(); // the data related to the bootstrap.ini file
+        static const Impl& data(); // the data related to the bootstrap.ini file
     };
 //-----------------------------------------------------------------------------
 } // namespace utl
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index 33d053c..fc21a87 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -86,9 +86,21 @@ namespace utl
 // Implementation class: Bootstrap::Impl
 // ---------------------------------------------------------------------------------------
 
+    namespace
+    {
+        rtl::OUString makeImplName()
+        {
+            rtl::OUString uri;
+            rtl::Bootstrap::get(
+                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")),
+                uri);
+            return uri + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME));
+        }
+    }
+
     class Bootstrap::Impl
     {
-        OUString const m_aImplName;
+        const OUString m_aImplName;
     public: // struct to cache the result of a path lookup
         struct PathData
         {
@@ -115,9 +127,7 @@ namespace utl
         Status status_;
 
     public: // construction and initialization
-        explicit
-        Impl(OUString const& _aImplName)
-        : m_aImplName(_aImplName)
+        Impl() : m_aImplName(makeImplName())
         {
             status_ = initialize();
         }
@@ -134,26 +144,16 @@ namespace utl
         bool initBaseInstallationData(rtl::Bootstrap& _rData);
         bool initUserInstallationData(rtl::Bootstrap& _rData);
     };
-// ---------------------------------------------------------------------------------------
-    static OUString getExecutableDirectory();
-// ---------------------------------------------------------------------------------------
 
     static Bootstrap::Impl* s_pData = NULL;
 
-    Bootstrap::Impl const& Bootstrap::data()
+    const Bootstrap::Impl& Bootstrap::data()
     {
-
         if (!s_pData)
         {
             using namespace osl;
             MutexGuard aGuard( Mutex::getGlobalMutex() );
-
-            // static Impl s_theData(getExecutableDirectory() + OUString(RTL_CONSTASCII_USTRINGPARAM("/"BOOTSTRAP_DATA_NAME)));
-            // s_pData = &s_theData;
-            rtl::OUString uri;
-            rtl::Bootstrap::get(
-                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")), uri);
-            s_pData = new Impl(uri + OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME)));
+            s_pData = new Impl;
         }
         return *s_pData;
     }
commit be987e667106dc956f2f86ebf5a4384db87ec7ed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 15:33:16 2011 +0100

    reduce spew somewhat, one warning is enough

diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx
index 286e599..2b89764 100644
--- a/svtools/source/config/menuoptions.cxx
+++ b/svtools/source/config/menuoptions.cxx
@@ -258,6 +258,10 @@ SvtMenuOptions_Impl::SvtMenuOptions_Impl()
         // Safe impossible cases.
         // Check any for valid value.
         DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nInvalid property value for property detected!\n" );
+
+        if (!seqValues[nProperty].hasValue())
+            continue;
+
         switch( nProperty )
         {
             case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES	:	{
commit 255782f64c1713b677f644a84a23ba4f02955871
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 13 09:08:39 2011 +0100

    valgrind: fix leak

diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx
index a278e04..738ec6d 100644
--- a/vcl/inc/vcl/ppdparser.hxx
+++ b/vcl/inc/vcl/ppdparser.hxx
@@ -324,8 +324,8 @@ public:
     void getUnconstrainedValues( const PPDKey*, ::std::list< const PPDValue* >& rValues );
 
     // for printer setup
-    void*   getStreamableBuffer( sal_uLong& rBytes ) const;
-    void    rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes );
+    char*   getStreamableBuffer( sal_uLong& rBytes ) const;
+    void    rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes );
 
     // convenience
     int getRenderResolution() const;
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index b25dacd..dfd2d3f 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -2052,7 +2052,7 @@ void PPDContext::getUnconstrainedValues( const PPDKey* pKey, ::std::list< const
 
 // -------------------------------------------------------------------
 
-void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
+char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
 {
     rBytes = 0;
     if( ! m_aCurrentValues.size() )
@@ -2098,14 +2098,14 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
 
 // -------------------------------------------------------------------
 
-void PPDContext::rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes )
+void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
 {
     if( ! m_pParser )
         return;
 
     m_aCurrentValues.clear();
 
-    char* pRun = (char*)pBuffer;
+    char* pRun = pBuffer;
     while( nBytes && *pRun )
     {
         ByteString aLine( pRun );
commit 1ede5c1ae2ccdfdbffaa6298500eb3fb698c6f96
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 10:09:00 2011 +0100

    fix merge conflicts

diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx
index a74a255..eced947 100644
--- a/vcl/unx/source/printer/jobdata.cxx
+++ b/vcl/unx/source/printer/jobdata.cxx
@@ -168,11 +168,10 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
     // now append the PPDContext stream buffer
     aStream.WriteLine( "PPDContexData" );
     sal_uLong nBytes;
-    // getStreamableBuffer allocates the buffer using new[]
-    void* pContextBuffer = m_aContext.getStreamableBuffer( nBytes );
+    char* pContextBuffer = m_aContext.getStreamableBuffer( nBytes );
     if( nBytes )
         aStream.Write( pContextBuffer, nBytes );
-    delete[] reinterpret_cast<char*>(pContextBuffer);
+    delete [] pContextBuffer;
 
     // success
     pData = rtl_allocateMemory( bytes = aStream.Tell() );
@@ -254,7 +253,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
                 {
                     rJobData.m_aContext.setParser( rJobData.m_pParser );
                     int nBytes = bytes - aStream.Tell();
-                    void* pRemain = alloca( bytes - aStream.Tell() );
+                    char* pRemain = (char*)alloca( bytes - aStream.Tell() );
                     aStream.Read( pRemain, nBytes );
                     rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes );
                     bContext = true;
commit ec9b2a710444b85f9c77184d128376359705de3c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 13 09:00:18 2011 +0100

    no need to cast

diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index efca0d1..b25dacd 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -2073,9 +2073,9 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
         rBytes += 1; // for '\0'
     }
     rBytes += 1;
-    void* pBuffer = new char[ rBytes ];
+    char* pBuffer = new char[ rBytes ];
     memset( pBuffer, 0, rBytes );
-    char* pRun = (char*)pBuffer;
+    char* pRun = pBuffer;
     for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it )
     {
         ByteString aCopy( it->first->getKey(), RTL_TEXTENCODING_MS_1252 );
commit 9fca8e0ae5ddd5d59b34a5489b7011d9098169f1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 12 22:42:51 2011 +0100

    add mg_MG alias for plt_MG

diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index 081f3bd..ef27d29 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -460,6 +460,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
     { LANGUAGE_USER_BUSHI,                 "buc", "YT" },
     { LANGUAGE_USER_TAHITIAN,               "ty", "PF" },
     { LANGUAGE_USER_MALAGASY_PLATEAU,      "plt", "MG" },
+    { LANGUAGE_USER_MALAGASY_PLATEAU,       "mg", "MG" },
     { LANGUAGE_USER_BAFIA,                 "ksf", "CM" },
     { LANGUAGE_USER_GIKUYU,                 "ki", "KE" },
     { LANGUAGE_USER_RUSYN_UKRAINE,         "rue", "UA" },
commit e61fc9637e900e2d2e801eb2028e6c07d89e1803
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 12 22:37:29 2011 +0100

    add an entry for Manx

diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h
index 94a4071..5bac08f 100644
--- a/i18npool/inc/i18npool/lang.h
+++ b/i18npool/inc/i18npool/lang.h
@@ -522,6 +522,7 @@ typedef unsigned short LanguageType;
 #define LANGUAGE_USER_LOJBAN                0x0658  /* no locale */
 #define LANGUAGE_USER_KABYLE                0x0659
 #define LANGUAGE_USER_HAITIAN               0x065A
+#define LANGUAGE_USER_MANX                  0x065B
 
 
 #endif /* INCLUDED_I18NPOOL_LANG_H */
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index c6004eb..081f3bd 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -469,6 +469,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
     { LANGUAGE_USER_KABYLE,                "kab", "DZ" },
     { LANGUAGE_USER_HAITIAN,                "ht", "HT" },
     { LANGUAGE_FRENCH_HAITI,                "fr", "HT" },
+    { LANGUAGE_USER_MANX,                   "gv", "GB" },
     { LANGUAGE_NONE,                       "zxx", ""   },   // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information
     { LANGUAGE_DONTKNOW,                    "",   ""   }    // marks end of table
 };
commit b5b708f2742c46b4772eb56a8f5ed80f1a6eef55
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 10 16:14:56 2011 +0100

    config leaks: make this a well behaved singleton

diff --git a/svtools/inc/svtools/htmlcfg.hxx b/svtools/inc/svtools/htmlcfg.hxx
index ef5a30e..dfef6c0 100644
--- a/svtools/inc/svtools/htmlcfg.hxx
+++ b/svtools/inc/svtools/htmlcfg.hxx
@@ -59,8 +59,8 @@ class SVT_DLLPUBLIC SvxHtmlOptions : public utl::ConfigItem
     void CallListeners();
 
 public:
-                    SvxHtmlOptions();
-                    ~SvxHtmlOptions();
+    SvxHtmlOptions();
+    ~SvxHtmlOptions();
 
     virtual void    Commit();
     virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
@@ -92,7 +92,7 @@ public:
     sal_Bool    IsDefaultTextEncoding() const;
     rtl_TextEncoding GetTextEncoding() const;
     void 		SetTextEncoding( rtl_TextEncoding );
-    static SvxHtmlOptions* Get();
+    static SvxHtmlOptions& Get();
 
     sal_Bool		IsNumbersEnglishUS() const;
     void		SetNumbersEnglishUS(sal_Bool bSet);
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
index fc793aa..89bccaa 100644
--- a/svtools/source/config/htmlcfg.cxx
+++ b/svtools/source/config/htmlcfg.cxx
@@ -35,6 +35,7 @@
 #include <tools/debug.hxx>
 #include <tools/link.hxx>
 #include <sal/macros.h>
+#include <rtl/instance.hxx>
 #include <list>
 
 // -----------------------------------------------------------------------
@@ -53,8 +54,6 @@ using namespace com::sun::star::uno;
 
 using ::rtl::OUString;
 
-static SvxHtmlOptions* pOptions = 0;
-
 #define C2U(cChar) OUString::createFromAscii(cChar)
 
 struct HtmlOptions_Impl
@@ -458,11 +457,14 @@ sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const
     return pImp->bIsEncodingDefault;
 }
 
-SvxHtmlOptions* SvxHtmlOptions::Get()
+namespace
+{
+    class theSvxHtmlOptions : public rtl::Static<SvxHtmlOptions, theSvxHtmlOptions> {};
+}
+
+SvxHtmlOptions& SvxHtmlOptions::Get()
 {
-    if ( !pOptions )
-        pOptions = new SvxHtmlOptions;
-    return pOptions;
+    return theSvxHtmlOptions::get();
 }
 
 sal_Bool SvxHtmlOptions::IsNumbersEnglishUS() const
commit 5cc8e7b4d7de76ff72e658b7895a5c07c7f5307f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 10 16:14:25 2011 +0100

    fix up mangled indent

diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index cb1cc62..9e0a655 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -2278,28 +2278,27 @@ TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( Window
     DBG_ASSERT( pWindow, "Window pointer is NULL" );
 
     Reference< XClipboard >	xClipboard;
-       TransferableDataHelper	aRet;
+    TransferableDataHelper	aRet;
 
     if( pWindow )
         xClipboard = pWindow->GetClipboard();
 
     if( xClipboard.is() )
-       {
-           try
-
+    {
+        try
         {
             Reference< XTransferable > xTransferable( xClipboard->getContents() );
 
             if( xTransferable.is() )
             {
                 aRet = TransferableDataHelper( xTransferable );
-                   aRet.mxClipboard = xClipboard;
-                    // also copy the clipboard
+                // also copy the clipboard
+                aRet.mxClipboard = xClipboard;
             }
-           }
+        }
         catch( const ::com::sun::star::uno::Exception& )
         {
-           }
+        }
     }
 
     return aRet;
commit 5ea438a225371d4b4dcea72dcf6f6ecb4d0f8a63
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 10 16:10:42 2011 +0100

    config leaks: add a template to handle tricky globals

diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk
index fb6538e..a02bde6 100644
--- a/comphelper/Package_inc.mk
+++ b/comphelper/Package_inc.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stillreadwritein
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/anycompare.hxx,comphelper/anycompare.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/propagg.hxx,comphelper/propagg.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scopeguard.hxx,comphelper/scopeguard.hxx))
+$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scoped_disposing_ptr.hxx,comphelper/scoped_disposing_ptr.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/asyncnotification.hxx,comphelper/asyncnotification.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/namedvaluecollection.hxx,comphelper/namedvaluecollection.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/composedprops.hxx,comphelper/composedprops.hxx))
diff --git a/comphelper/inc/comphelper/scoped_disposing_ptr.hxx b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx
new file mode 100644
index 0000000..5e63f1d
--- /dev/null
+++ b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *        Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm at redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef _SCOPED_DISPOSING_PTR
+#define _SCOPED_DISPOSING_PTR
+
+#include <cppuhelper/implbase1.hxx>
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <stdio.h>
+
+namespace comphelper
+{
+//Similar to boost::scoped_ptr, except additionally releases the ptr on rComponent::disposing
+template<class T> class scoped_disposing_ptr : private boost::noncopyable
+{
+private:
+    boost::scoped_ptr<T> m_aItem;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener> m_xDisposingListener;
+public:
+    scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+        : m_aItem(p)
+    {
+        m_xDisposingListener = new DisposingListener(rComponent, m_aItem);
+    }
+
+    void reset(T * p = 0)
+    {
+        m_aItem.reset(p);
+    }
+
+    T & operator*() const
+    {
+        return *m_aItem;
+    }
+
+    T * get() const
+    {
+        return m_aItem.get();
+    }
+
+    T * operator->() const
+    {
+        return m_aItem.get();
+    }
+
+    operator bool () const
+    {
+        return m_aItem;
+    }
+
+    virtual ~scoped_disposing_ptr()
+    {
+        reset();
+    }
+private:
+    class DisposingListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+    {
+    private:
+        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent;
+        boost::scoped_ptr<T>& m_rItem;
+    public:
+        DisposingListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent,
+            boost::scoped_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem)
+        {
+            if (m_xComponent.is())
+                m_xComponent->addEventListener( this );
+        }
+
+        ~DisposingListener()
+        {
+            if ( m_xComponent.is() )
+                m_xComponent->removeEventListener( this );
+        }
+
+    private:
+        // XEventListener
+        virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & rEvt )
+            throw (::com::sun::star::uno::RuntimeException)
+        {
+            bool shutDown = (rEvt.Source == m_xComponent);
+
+            if ( shutDown && m_xComponent.is() )
+            {
+                m_xComponent->removeEventListener( this );
+                m_xComponent.clear();
+            }
+
+            if ( shutDown )
+               m_rItem.reset();
+        }
+    };
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e790d9086c8dcf81ebfc2bf439dfaee33f906d6c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 8 21:30:38 2011 +0100

    adjust for OUString

diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
index 892dd1c..308a858 100644
--- a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
+++ b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
@@ -109,8 +109,7 @@ sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUSt
         }
         rtl::OUString sTemp(OUString(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?") )));
         sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?'));
-        sTemp.replaceAt(nIndex, 1, sFilterName);
-        sFilterName = sTemp;
+        sFilterName = sTemp.replaceAt(nIndex, 1, sFilterName);
     }
     return sFilterName.Len() != 0;
 }
commit 1c938d45a85d08bc5f114036b563bb434186ab89
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 7 23:29:47 2011 +0100

    valgrind: remove leak by porting from UniString to rtl::OUString

diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
index 123f4de..892dd1c 100644
--- a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
+++ b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx
@@ -107,10 +107,10 @@ sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUSt
             if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) )
                 bIsPixelFormat = sal_True;
         }
-        String aTemp( OUString(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "?" ) )) );
-        xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' );
-        aTemp.Replace( nIndex, 1, sFilterName );
-        sFilterName = aTemp;
+        rtl::OUString sTemp(OUString(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?") )));
+        sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?'));
+        sTemp.replaceAt(nIndex, 1, sFilterName);
+        sFilterName = sTemp;
     }
     return sFilterName.Len() != 0;
 }
commit dada939dc322735e0b32cf41d29847ae332d68bd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 6 11:35:29 2011 +0100

    config leaks: drop dodgy LegacySingleton foo

diff --git a/unotools/inc/unotools/componentresmodule.hxx b/unotools/inc/unotools/componentresmodule.hxx
index 989f982..0ac905a 100644
--- a/unotools/inc/unotools/componentresmodule.hxx
+++ b/unotools/inc/unotools/componentresmodule.hxx
@@ -149,22 +149,8 @@ namespace utl
         OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
         { \
         } \
-    }; \
-    \
-    /* -------------------------------------------------------------------- */ \
-    template < class TYPE > \
-    class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \
-    { \
-    private: \
-        typedef ::comphelper::OLegacySingletonRegistration< TYPE >    BaseClass; \
-    \
-    public: \
-        OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
-        { \
-        } \
     };
 
-
     //====================================================================
     //= implementing a concrete module
     //====================================================================
commit 8ec25d111cb9b3dae24687f06edd0fb8fdd9d721
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 6 11:31:54 2011 +0100

    config leaks: drop dodgy LegacySingleton foo

diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk
index 7c365bc..8336b8c 100644
--- a/comphelper/Library_comphelp.mk
+++ b/comphelper/Library_comphelp.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
     comphelper/source/misc/ihwrapnofilter \
     comphelper/source/misc/instancelocker \
     comphelper/source/misc/interaction \
-    comphelper/source/misc/legacysingletonfactory \
     comphelper/source/misc/listenernotification \
     comphelper/source/misc/locale \
     comphelper/source/misc/logging \
diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk
index 5794c56..fb6538e 100644
--- a/comphelper/Package_inc.mk
+++ b/comphelper/Package_inc.mk
@@ -89,7 +89,6 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ChainablePropert
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stl_types.hxx,comphelper/stl_types.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/eventattachermgr.hxx,comphelper/eventattachermgr.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/componentcontext.hxx,comphelper/componentcontext.hxx))
-$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/legacysingletonfactory.hxx,comphelper/legacysingletonfactory.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/accessibleeventnotifier.hxx,comphelper/accessibleeventnotifier.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ihwrapnofilter.hxx,comphelper/ihwrapnofilter.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/sequenceasvector.hxx,comphelper/sequenceasvector.hxx))
diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx
index 1fa3344..1cab942 100644
--- a/comphelper/inc/comphelper/componentmodule.hxx
+++ b/comphelper/inc/comphelper/componentmodule.hxx
@@ -29,7 +29,6 @@
 #define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
 
 #include <comphelper/comphelperdllapi.h>
-#include <comphelper/legacysingletonfactory.hxx>
 
 /** === begin UNO includes === **/
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -272,29 +271,6 @@ namespace comphelper
     }
 
     //==========================================================================
-    //= OLegacySingletonRegistration
-    //==========================================================================
-    template <class TYPE>
-    class OLegacySingletonRegistration
-    {
-    public:
-        OLegacySingletonRegistration( OModule& _rModule );
-    };
-
-    //--------------------------------------------------------------------------
-    template <class TYPE>
-    OLegacySingletonRegistration<TYPE>::OLegacySingletonRegistration( OModule& _rModule )
-    {
-        _rModule.registerImplementation( ComponentDescription(
-            TYPE::getImplementationName_static(),
-            TYPE::getSupportedServiceNames_static(),
-            ::rtl::OUString(),
-            &TYPE::Create,
-            &::comphelper::createLegacySingletonFactory
-        ) );
-    }
-
-    //==========================================================================
     //= helpers
     //==========================================================================
 
@@ -350,19 +326,7 @@ namespace comphelper
         OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
         { \
         } \
-    }; \
-    /* -------------------------------------------------------------------- */ \
-    template < class TYPE > \
-    class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \
-    { \
-    private: \
-        typedef ::comphelper::OLegacySingletonRegistration< TYPE >  BaseClass; \
-    \
-    public: \
-        OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
-        { \
-        } \
-    }; \
+    };
 
     //==========================================================================
     //= implementing a OModule for a component library
diff --git a/comphelper/inc/comphelper/legacysingletonfactory.hxx b/comphelper/inc/comphelper/legacysingletonfactory.hxx
deleted file mode 100644
index 139efd3..0000000
--- a/comphelper/inc/comphelper/legacysingletonfactory.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef COMPHELPER_LEGACYSINGLETONFACTORY_HXX
-#define COMPHELPER_LEGACYSINGLETONFACTORY_HXX
-
-#include "comphelper/comphelperdllapi.h"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <cppuhelper/factory.hxx>
-
-//........................................................................
-namespace comphelper
-{
-//........................................................................
-
-/** creates a factory which can be used when implementing old-style singletons
-
-    Before UNO having the component context concept, singletons were implemented by providing
-    a factory which return the very same component instance for every creation request.
-
-    Nowadays, singletons are implemented by making them available at the component context,
-    as dedicated property.
-
-    To bridge between both worlds - sometimes necessary to support legacy code, which instantiates
-    singletons at the global service manager, instead of obtaining the property at the
-    component context -, you can use the function below. I creates a single-component
-    factory, which behaves like the old factories did: Upon multiple creation requests,
-    it will always return the same instance. Additionally, the signature of the function
-    is the same as the signature of <code>::cppu::createSingleComponentFactory</code>
-    (which creates a "normal" component factory), so you can use both factory functions
-    in the same context.
-*/
-::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >
-    COMPHELPER_DLLPUBLIC createLegacySingletonFactory(
-        ::cppu::ComponentFactoryFunc _componentFactoryFunc,
-        const ::rtl::OUString& _rImplementationName,
-        const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames,
-        rtl_ModuleCount* _pModCount = NULL
-    );
-
-//........................................................................
-} // namespace comphelper
-//........................................................................
-
-#endif // COMPHELPER_LEGACYSINGLETONFACTORY_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/misc/legacysingletonfactory.cxx b/comphelper/source/misc/legacysingletonfactory.cxx
deleted file mode 100644
index 53b76c7..0000000
--- a/comphelper/source/misc/legacysingletonfactory.cxx
+++ /dev/null
@@ -1,200 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_comphelper.hxx"
-
-#include "comphelper/legacysingletonfactory.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/implbase2.hxx>
-
-#include <algorithm>
-
-//........................................................................
-namespace comphelper
-{
-//........................................................................
-
-    /** === begin UNO using === **/
-    using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::uno::XInterface;
-    using ::com::sun::star::uno::UNO_QUERY;
-    using ::com::sun::star::uno::UNO_QUERY_THROW;
-    using ::com::sun::star::uno::UNO_SET_THROW;
-    using ::com::sun::star::uno::Exception;
-    using ::com::sun::star::uno::RuntimeException;
-    using ::com::sun::star::uno::Any;
-    using ::com::sun::star::uno::makeAny;
-    using ::com::sun::star::lang::XSingleComponentFactory;
-    using ::com::sun::star::uno::Sequence;
-    using ::com::sun::star::uno::XComponentContext;
-    using ::com::sun::star::lang::XServiceInfo;
-    using ::com::sun::star::lang::XInitialization;
-    /** === end UNO using === **/
-
-    //====================================================================
-    //= LegacySingletonFactory
-    //====================================================================
-    typedef ::cppu::WeakImplHelper2 <   XServiceInfo
-                                    ,   XSingleComponentFactory
-                                    >   LegacySingletonFactory_Base;
-
-    class COMPHELPER_DLLPRIVATE LegacySingletonFactory : public LegacySingletonFactory_Base
-    {
-    public:
-        LegacySingletonFactory(
-            ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName,
-            const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount
-        );
-
-        // XServiceInfo
-        virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (RuntimeException);
-        virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
-        virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException);
-
-        // XSingleComponentFactory
-        virtual Reference< XInterface > SAL_CALL createInstanceWithContext( const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException);
-        virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const Sequence< Any >& Arguments, const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException);
-
-    protected:
-        ~LegacySingletonFactory();
-
-    private:
-        /** creates m_xInstance, returns whether it actually was created (<TRUE/>) or existed before (<FALSE/>
-        */
-        bool    impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext );
-
-    private:
-        ::osl::Mutex                    m_aMutex;
-        ::cppu::ComponentFactoryFunc    m_componentFactoryFunc;
-        ::rtl::OUString                 m_sImplementationName;
-        Sequence< ::rtl::OUString >     m_aServiceNames;
-        rtl_ModuleCount*                m_pModuleCount;
-        Reference< XInterface >         m_xTheInstance;
-    };
-
-    //--------------------------------------------------------------------
-    LegacySingletonFactory::LegacySingletonFactory( ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName,
-            const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount )
-        :m_componentFactoryFunc ( _componentFactoryFunc )
-        ,m_sImplementationName  ( _rImplementationName )
-        ,m_aServiceNames        ( _rServiceNames )
-        ,m_pModuleCount         ( _pModCount )
-        ,m_xTheInstance         ( )
-    {
-        if ( m_pModuleCount )
-            m_pModuleCount->acquire( m_pModuleCount );
-    }
-
-    //--------------------------------------------------------------------
-    LegacySingletonFactory::~LegacySingletonFactory()
-    {
-        if ( m_pModuleCount )
-            m_pModuleCount->release( m_pModuleCount );
-    }
-
-    //--------------------------------------------------------------------
-    ::rtl::OUString SAL_CALL LegacySingletonFactory::getImplementationName(  ) throw (RuntimeException)
-    {
-        return m_sImplementationName;
-    }
-    
-    //--------------------------------------------------------------------
-    ::sal_Bool SAL_CALL LegacySingletonFactory::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
-    {
-        Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() );
-        const ::rtl::OUString* pStart = aServices.getConstArray();
-        const ::rtl::OUString* pEnd = aServices.getConstArray() + aServices.getLength();
-        return ::std::find( pStart, pEnd, _rServiceName ) != pEnd;
-    }
-    
-    //--------------------------------------------------------------------
-    Sequence< ::rtl::OUString > SAL_CALL LegacySingletonFactory::getSupportedServiceNames(  ) throw (RuntimeException)
-    {
-        return m_aServiceNames;
-    }
-
-    //--------------------------------------------------------------------
-    bool LegacySingletonFactory::impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext )
-    {
-        if ( m_xTheInstance.is() )
-            return false;
-
-        m_xTheInstance = (*m_componentFactoryFunc)( _rxContext );
-        if ( !m_xTheInstance.is() )
-            throw RuntimeException();
-
-        return true;    // true -> "was newly created"
-    }
-
-    //--------------------------------------------------------------------
-    Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithContext( const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException)
-    {
-        ::osl::MutexGuard aGuard( m_aMutex );
-        impl_nts_ensureInstance( _rxContext );
-
-        return m_xTheInstance;
-    }
-    
-    //--------------------------------------------------------------------
-    Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithArgumentsAndContext( const Sequence< Any >& _rArguments, const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException)
-    {
-        ::osl::MutexGuard aGuard( m_aMutex );
-        if ( !impl_nts_ensureInstance( _rxContext ) )
-            throw RuntimeException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Instance already created before, unable to initialize it." ) ),
-                *this
-            );
-
-        Reference< XInitialization > xInit( m_xTheInstance, UNO_QUERY_THROW );
-        xInit->initialize( _rArguments );
-
-        return m_xTheInstance;
-    }
-
-    //====================================================================
-    //= createLegacySingletonFactory
-    //====================================================================
-    Reference< XSingleComponentFactory > createLegacySingletonFactory(
-        ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName,
-        const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount )
-    {
-        return new LegacySingletonFactory( _componentFactoryFunc, _rImplementationName, _rServiceNames, _pModCount );
-    }
-
-
-//........................................................................
-} // namespace comphelper
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 20e5ac3d65254931f190701c94d0d8ca6b7b21e3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 5 16:17:24 2011 +0100

    add XComponent.hpp

diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx
index c1aa3ac..efbff3d 100644
--- a/padmin/source/pamain.cxx
+++ b/padmin/source/pamain.cxx
@@ -46,12 +46,12 @@
 #include "unotools/configmgr.hxx"
 
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
 
 using namespace padmin;
 using namespace cppu;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
-using namespace com::sun::star::frame;
 using namespace comphelper;
 
 using ::rtl::OUString;
commit 5bea96079ec946a602eb3a046591e3f7647b03a0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 5 13:38:55 2011 +0100

    config leaks etc., dispose default component

diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx
index b7ff98c..c1aa3ac 100644
--- a/padmin/source/pamain.cxx
+++ b/padmin/source/pamain.cxx
@@ -51,6 +51,7 @@ using namespace padmin;
 using namespace cppu;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
 using namespace comphelper;
 
 using ::rtl::OUString;
@@ -104,10 +105,11 @@ int MyApp::Main()
     //-------------------------------------------------
     // create the global service-manager
     //-------------------------------------------------
+    Reference< XComponentContext > xCtx;
     Reference< XMultiServiceFactory > xFactory;
     try
     {
-        Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
+        xCtx = defaultBootstrap_InitialComponentContext();
         xFactory = Reference< XMultiServiceFactory >(  xCtx->getServiceManager(), UNO_QUERY );
         if( xFactory.is() )
             setProcessServiceFactory( xFactory );
@@ -175,6 +177,18 @@ int MyApp::Main()
      */
     ::ucbhelper::ContentBroker::deinitialize();
 
+    /*
+     *  clean up UNO
+     */
+    try
+    {
+        Reference<XComponent> xComp(xCtx, UNO_QUERY_THROW);
+        xComp->dispose();
+    }
+    catch(...)
+    {
+    }
+
     return EXIT_SUCCESS;
 }
 
commit b33a6e5f0a5f3e63105321238702961f4acae315
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 19 16:41:41 2011 +0100

    WaE: unused parameter

diff --git a/comphelper/inc/comphelper/types.hxx b/comphelper/inc/comphelper/types.hxx
index ba39c32..9a80676 100644
--- a/comphelper/inc/comphelper/types.hxx
+++ b/comphelper/inc/comphelper/types.hxx
@@ -104,7 +104,7 @@ namespace comphelper
     /** check if a type you have at hand at runtime is equal to another type you have at compile time
     */
     template <class TYPE>
-    sal_Bool isAReference(const staruno::Any& _rVal, TYPE* pDummy)
+    sal_Bool isAReference(const staruno::Any& _rVal, TYPE*)
     {
         return  _rVal.getValueType().equals(
             cppu::getTypeFavourUnsigned(
commit ce4f509e08854e98fffc82f5139a38431a34f04f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 19 16:29:27 2011 +0100

    this can be passed by reference, like the name suggests

diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx
index 854570e..19ca23e 100644
--- a/unotools/inc/unotools/configitem.hxx
+++ b/unotools/inc/unotools/configitem.hxx
@@ -115,7 +115,7 @@ namespace utl
                                         GetTree();
 
         protected:
-            ConfigItem(const rtl::OUString rSubTree,
+            ConfigItem(const rtl::OUString &rSubTree,
                         sal_Int16 nMode = CONFIG_MODE_DELAYED_UPDATE);
             ConfigItem(utl::ConfigManager&  rManager, const rtl::OUString rSubTree);
 
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index ae7b4d3..a1f144b 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -219,7 +219,7 @@ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) thro
     pParent->RemoveChangesListener();
 }
 
-ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) :
+ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) :
     sSubTree(rSubTree),
     pImpl(new ConfigItem_Impl)
 {


More information about the Libreoffice-commits mailing list