[Libreoffice-commits] .: 8 commits - animations/source sd/inc sd/source

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


 animations/source/animcore/animcore.cxx                 |    2 
 sd/inc/TransitionPreset.hxx                             |    2 
 sd/source/core/TransitionPreset.cxx                     |   34 +++++++++++-----
 sd/source/filter/grf/sdgrffilter.cxx                    |   22 +++++-----
 sd/source/ui/app/sdmod.cxx                              |    2 
 sd/source/ui/dlg/sduiexp.cxx                            |   14 ------
 sd/source/ui/func/fuinsert.cxx                          |    2 
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx |    1 
 sd/source/ui/toolpanel/ToolPanelViewShell.cxx           |    1 
 sd/source/ui/unoidl/sddetect.cxx                        |    4 -
 sd/source/ui/view/sdview4.cxx                           |    4 -
 11 files changed, 46 insertions(+), 42 deletions(-)

New commits:
commit 901690d2cfaf1e5575af0657a9035baa5bfdaa97
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 19 23:10:04 2011 +0100

    adjust for return by ref instead of pointer

diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index aa80d7e..c487914 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -208,18 +208,18 @@ sal_Bool SdGRFFilter::Import()
 {
     Graphic         aGraphic;
     const String    aFileName( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
-    GraphicFilter*  pGraphicFilter = GraphicFilter::GetGraphicFilter();
-    const sal_uInt16    nFilter = pGraphicFilter->GetImportFormatNumberForTypeName( mrMedium.GetFilter()->GetTypeName() );
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+    const sal_uInt16 nFilter = rGraphicFilter.GetImportFormatNumberForTypeName( mrMedium.GetFilter()->GetTypeName() );
     sal_Bool		bRet = sal_False;
 
     // ggf. Filterdialog ausfuehren
-    if ( !pGraphicFilter->HasImportDialog( nFilter ) || pGraphicFilter->DoImportDialog( NULL, nFilter ) )
+    if ( !rGraphicFilter.HasImportDialog( nFilter ) || rGraphicFilter.DoImportDialog( NULL, nFilter ) )
     {
         SvStream*		pIStm = mrMedium.GetInStream();
-        sal_uInt16			nReturn = pIStm ? pGraphicFilter->ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : 1;
+        sal_uInt16			nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : 1;
 
         if( nReturn )
-            HandleGraphicFilterError( nReturn, pGraphicFilter->GetLastError().nStreamError );
+            HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError );
         else
         {
             if( mrDocument.GetPageCount() == 0L )
@@ -310,11 +310,11 @@ sal_Bool SdGRFFilter::Export()
                 {
                     uno::Reference< lang::XComponent > xSource( pPage->getUnoPage(), uno::UNO_QUERY );
                     SfxItemSet* pSet = mrMedium.GetItemSet();
-                    GraphicFilter*  pGraphicFilter = GraphicFilter::GetGraphicFilter();
-                    if ( pSet && pGraphicFilter && xSource.is() )
+                    if ( pSet && xSource.is() )
                     {
                         const String aTypeName( mrMedium.GetFilter()->GetTypeName() );
-                        const sal_uInt16 nFilter = pGraphicFilter->GetExportFormatNumberForTypeName( aTypeName );
+                        GraphicFilter &rGraphicFilter = GraphicFilter::GetGraphicFilter();
+                        const sal_uInt16 nFilter = rGraphicFilter.GetExportFormatNumberForTypeName( aTypeName );
                         if ( nFilter != GRFILTER_FORMAT_NOTFOUND )
                         {
                             uno::Reference< task::XInteractionHandler > mXInteractionHandler;
@@ -324,7 +324,7 @@ sal_Bool SdGRFFilter::Export()
 
                             rtl::OUString sInteractionHandler( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
                             rtl::OUString sFilterName( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
-                            rtl::OUString sShortName( pGraphicFilter->GetExportFormatShortName( nFilter ) );
+                            rtl::OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) );
 
                             sal_Bool	bFilterNameFound = sal_False;
                             sal_Int32	i, nCount;
@@ -374,7 +374,7 @@ sal_Bool SdGRFFilter::Export()
                             if ( !bRet && mXInteractionHandler.is() )
                                 SdGRFFilter::HandleGraphicFilterError(
                                     static_cast< SdGRFFilter_ImplInteractionHdl* >( mXInteractionHandler.get() )->GetErrorCode(),
-                                                    pGraphicFilter->GetLastError().nStreamError );
+                                                    rGraphicFilter.GetLastError().nStreamError );
                         }
                      }
                 }
@@ -476,7 +476,7 @@ void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< ::com::su
 
         // populate filter dialog filter list and select default filter to match graphic mime type
 
-        GraphicFilter& rGF = *GraphicFilter::GetGraphicFilter();
+        GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
         Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
         OUString aDefaultFormatName;
         sal_uInt16 nCount = rGF.GetExportFormatCount();
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 0f1d62e..3d958b5 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -169,7 +169,7 @@ void FuInsertGraphic::DoExecute( SfxRequest&  )
         }
         else
         {
-            SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter()->GetLastError().nStreamError );
+            SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter().GetLastError().nStreamError );
         }
     }
 }
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
index afcc9dc..b407052 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -361,7 +361,6 @@ SdFilterDetect::~SdFilterDetect()
 
                             const String        aFileName( aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
                             GraphicDescriptor   aDesc( *pStm, &aFileName );
-                            GraphicFilter*      pGrfFilter = GraphicFilter::GetGraphicFilter();
                             if( !aDesc.Detect( sal_False ) )
                             {
                                 pFilter = 0;
@@ -385,7 +384,8 @@ SdFilterDetect::~SdFilterDetect()
                             else
                             {
                                 String aShortName( aDesc.GetImportFormatShortName( aDesc.GetFileFormat() ) );
-                                const String aName( pGrfFilter->GetImportFormatTypeName( pGrfFilter->GetImportFormatNumberForShortName( aShortName ) ) );
+                                GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter();
+                                const String aName( rGrfFilter.GetImportFormatTypeName( rGrfFilter.GetImportFormatNumberForShortName( aShortName ) ) );
 
                                 if ( pFilter && aShortName.EqualsIgnoreCaseAscii( "PCD" ) )    // there is a multiple pcd selection possible
                                 {
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 98e6786..5e9c442 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -386,14 +386,14 @@ IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG )
             aURL = INetURLObject( aURLStr );
         }
 
-        GraphicFilter*  pGraphicFilter = GraphicFilter::GetGraphicFilter();
+        GraphicFilter&  rGraphicFilter = GraphicFilter::GetGraphicFilter();
         Graphic			aGraphic;
 
         aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
 
         if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) )
         {
-            if( !pGraphicFilter->ImportGraphic( aGraphic, aURL ) )
+            if( !rGraphicFilter.ImportGraphic( aGraphic, aURL ) )
             {
                 sal_Int8    nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
                 InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
commit 842aa549d2bf1fe05f7b350999ee8b0af832963d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 17 21:38:52 2011 +0100

    adjust to ensure rename

diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 2526378..ecc617f 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -102,7 +102,7 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
     pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
     pSearchItem->SetAppFlag(SVX_SEARCHAPP_DRAW);
     StartListening( *SFX_APP() );
-    SvxErrorHandler::Get();
+    SvxErrorHandler::ensure();
     mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL,
                                          ERRCODE_AREA_SD,
                                          ERRCODE_AREA_SD_END,
commit cf1b92cd8ebeee3e00e6fb7e59a11a6333df45bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 10 10:50:31 2011 +0100

    config leaks: missing Disconnects

diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index f2bb771..b0902a6 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -171,6 +171,7 @@ SlideSorterViewShell::~SlideSorterViewShell (void)
         (void)e;
         OSL_FAIL("sd::SlideSorterViewShell::~SlideSorterViewShell(), exception caught!" );
     }
+    GetFrameView()->Disconnect();
 }
 
 
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index 0ea4534..514a48b 100644
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -556,6 +556,7 @@ ToolPanelViewShell::~ToolPanelViewShell()
     // disposed/destroyed, too
     mpImpl.reset();
     GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
+    GetFrameView()->Disconnect();
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
commit 9390a942e28b1fae63258b1d7304b0f92964446b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 9 12:22:19 2011 +0100

    valgrind: in what planet did that make sense

diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 693c8d3..debcd48 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -744,7 +744,7 @@ void SAL_CALL AnimationNode::acquire(  ) throw ()
 // XInterface
 void SAL_CALL AnimationNode::release(  ) throw ()
 {
-    OWeakObject::acquire();
+    OWeakObject::release();
 }
 
 // --------------------------------------------------------------------
commit 4c14cb3139b231b054627e334e9f2d323e790b99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 8 22:16:13 2011 +0100

    valgrind: make this a well behaved non-leaking singleton

diff --git a/sd/inc/TransitionPreset.hxx b/sd/inc/TransitionPreset.hxx
index dbc7497..cbdac52 100644
--- a/sd/inc/TransitionPreset.hxx
+++ b/sd/inc/TransitionPreset.hxx
@@ -78,8 +78,6 @@ private:
     rtl::OUString maPresetId;
     rtl::OUString maUIName;
 
-    static sd::TransitionPresetList* mpTransitionPresetList;
-
     static bool importTransitionsFile( TransitionPresetList& rList,
                                        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
                                        UStringMap& rTransitionNameMape,
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index 7933702..049129e 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -45,6 +45,7 @@
 #include <tools/stream.hxx>
 
 #include <rtl/uri.hxx>
+#include <rtl/instance.hxx>
 #include <tools/debug.hxx>
 
 #include <TransitionPreset.hxx>
@@ -225,21 +226,34 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
     return bRet;
 }
 
-TransitionPresetList* TransitionPreset::mpTransitionPresetList = 0;
-
-const TransitionPresetList& TransitionPreset::getTransitionPresetList()
+namespace
 {
-    if( !mpTransitionPresetList )
+    class ImportedTransitionPresetList
     {
-        SolarMutexGuard aGuard;
-        if( !mpTransitionPresetList )
+    private:
+        sd::TransitionPresetList m_aTransitionPresetList;
+    public:
+        ImportedTransitionPresetList()
         {
-            mpTransitionPresetList = new sd::TransitionPresetList();
-            sd::TransitionPreset::importTransitionPresetList( *mpTransitionPresetList );
+            sd::TransitionPreset::importTransitionPresetList(
+                m_aTransitionPresetList);
         }
-    }
+        const sd::TransitionPresetList& getList() const
+        {
+            return m_aTransitionPresetList;
+        }
+    };
 
-    return *mpTransitionPresetList;
+    class theTransitionPresetList :
+        public rtl::Static<ImportedTransitionPresetList,
+                           theTransitionPresetList>
+    {
+    };
+}
+
+const TransitionPresetList& TransitionPreset::getTransitionPresetList()
+{
+    return theTransitionPresetList::get().getList();
 }
 
 void TransitionPreset::apply( SdPage* pSlide ) const
commit 134b59947acbc6e6902aeef9c6c71f3120879501
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 7 23:03:52 2011 +0100

    valgrind: remove leak

diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx
index 06f94d9..3f53883 100644
--- a/sd/source/ui/dlg/sduiexp.cxx
+++ b/sd/source/ui/dlg/sduiexp.cxx
@@ -36,22 +36,12 @@
 #include "sddlgfact.hxx"
 #include "sal/types.h"
 
-namespace sdui
-{
-    static SdAbstractDialogFactory_Impl* pFactory=NULL;
-    SdAbstractDialogFactory_Impl* GetFactory()
-    {
-        if ( !pFactory )
-            pFactory = new SdAbstractDialogFactory_Impl;
-        return pFactory;
-    }
-}
-
 extern "C"
 {
     SAL_DLLPUBLIC_EXPORT SdAbstractDialogFactory* CreateDialogFactory()
     {
-        return ::sdui::GetFactory();
+        static SdAbstractDialogFactory_Impl aFactory;
+        return &aFactory;
     }
 }
 
commit 4051494cb3f876a08bf202db40c0284ff45204a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 3 23:05:06 2011 +0100

    Reverting: should happen via Disconnect
    
    This reverts commit 1ccbe907c4f83ec0357874ccb31aaaaf722f1de8.

diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index 9ff6095..8d4faa1 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -198,8 +198,6 @@ protected:
 private:
     ::boost::shared_ptr<SlideSorter> mpSlideSorter;
     bool mbIsArrangeGUIElementsPending;
-
-    bool m_bCreatedOwnFrameView;
     
     SlideSorterViewShell (
         SfxViewFrame* pFrame, 
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 2fc83f8..f2bb771 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -136,15 +136,9 @@ SlideSorterViewShell::SlideSorterViewShell (
     meShellType = ST_SLIDE_SORTER;
 
     if (pFrameViewArgument != NULL)
-    {
         mpFrameView = pFrameViewArgument;
-        m_bCreatedOwnFrameView = false;
-    }
     else
-    {
         mpFrameView = new FrameView(GetDoc());
-        m_bCreatedOwnFrameView = true;
-    }
     GetFrameView()->Connect();
 
     SetName (String (RTL_CONSTASCII_USTRINGPARAM("SlideSorterViewShell")));
@@ -177,8 +171,6 @@ SlideSorterViewShell::~SlideSorterViewShell (void)
         (void)e;
         OSL_FAIL("sd::SlideSorterViewShell::~SlideSorterViewShell(), exception caught!" );
     }
-    if (m_bCreatedOwnFrameView)
-        delete mpFrameView;
 }
 
 
commit 6386d5e398377d49e027454504cca8898b90e6de
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 3 21:42:50 2011 +0100

    configitem leak: if we create a FrameView we presumably have to delete it

diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index 8d4faa1..9ff6095 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -198,6 +198,8 @@ protected:
 private:
     ::boost::shared_ptr<SlideSorter> mpSlideSorter;
     bool mbIsArrangeGUIElementsPending;
+
+    bool m_bCreatedOwnFrameView;
     
     SlideSorterViewShell (
         SfxViewFrame* pFrame, 
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index f2bb771..2fc83f8 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -136,9 +136,15 @@ SlideSorterViewShell::SlideSorterViewShell (
     meShellType = ST_SLIDE_SORTER;
 
     if (pFrameViewArgument != NULL)
+    {
         mpFrameView = pFrameViewArgument;
+        m_bCreatedOwnFrameView = false;
+    }
     else
+    {
         mpFrameView = new FrameView(GetDoc());
+        m_bCreatedOwnFrameView = true;
+    }
     GetFrameView()->Connect();
 
     SetName (String (RTL_CONSTASCII_USTRINGPARAM("SlideSorterViewShell")));
@@ -171,6 +177,8 @@ SlideSorterViewShell::~SlideSorterViewShell (void)
         (void)e;
         OSL_FAIL("sd::SlideSorterViewShell::~SlideSorterViewShell(), exception caught!" );
     }
+    if (m_bCreatedOwnFrameView)
+        delete mpFrameView;
 }
 
 


More information about the Libreoffice-commits mailing list