[Libreoffice-commits] .: 3 commits - basctl/source basic/inc

August Sodora augsod at kemper.freedesktop.org
Fri Jan 20 17:48:18 PST 2012


 basctl/source/basicide/basicbox.cxx |    2 +-
 basctl/source/basicide/baside3.cxx  |    2 +-
 basctl/source/basicide/basides1.cxx |    2 +-
 basctl/source/basicide/basidesh.cxx |    7 +------
 basctl/source/dlged/managelang.cxx  |    9 ++-------
 basctl/source/inc/basidesh.hxx      |    4 ++--
 basctl/source/inc/managelang.hxx    |    8 ++++----
 basic/inc/basic/sbxmeth.hxx         |    7 -------
 8 files changed, 12 insertions(+), 29 deletions(-)

New commits:
commit 90e983df7b79d9022e24926d770298227becb342
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 20 20:23:06 2012 -0500

    Use a smart pointer here instead

diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index c197500..cb56870 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -424,7 +424,7 @@ void BasicLanguageBox::FillBox()
     m_sCurrentText = GetSelectEntry();
     ClearBox();
 
-    LocalizationMgr* pCurMgr = BasicIDEGlobals::GetShell()->GetCurLocalizationMgr();
+    boost::shared_ptr<LocalizationMgr> pCurMgr(BasicIDEGlobals::GetShell()->GetCurLocalizationMgr());
     if ( pCurMgr->isLibraryLocalized() )
     {
         Enable();
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 55e72c9..7db5434 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1152,7 +1152,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const
                 bool bCopyResourcesForDialog = true;
                 if( bAddDialogLanguagesToLib )
                 {
-                    LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr();
+                    boost::shared_ptr<LocalizationMgr> pCurMgr = pIDEShell->GetCurLocalizationMgr();
 
                     lang::Locale aFirstLocale;
                     aFirstLocale = aOnlyInImportLanguages[0];
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index bcf4006..f404f37 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -1024,7 +1024,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
                 else
                 {
                     ::rtl::OUString aItemStr;
-                    LocalizationMgr* pCurMgr = GetCurLocalizationMgr();
+                    boost::shared_ptr<LocalizationMgr> pCurMgr(GetCurLocalizationMgr());
                     if ( pCurMgr->isLibraryLocalized() )
                     {
                         Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 4aabe00..8458625 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -206,8 +206,6 @@ void BasicIDEShell::Init()
     pObjectCatalog = 0;
     bCreatingWindow = sal_False;
 
-    m_pCurLocalizationMgr = NULL;
-
     pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() );
     pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) );
     bTabBarSplitted = sal_False;
@@ -245,8 +243,6 @@ BasicIDEShell::~BasicIDEShell()
     SetWindow( 0 );
     SetCurWindow( 0 );
 
-    delete m_pCurLocalizationMgr;
-
     IDEBaseWindow* pWin = aIDEWindowTable.First();
     while ( pWin )
     {
@@ -1014,7 +1010,6 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString
 void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName )
 {
     // Create LocalizationMgr
-    delete m_pCurLocalizationMgr;
     Reference< resource::XStringResourceManager > xStringResourceManager;
     try
     {
@@ -1026,9 +1021,8 @@ void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, :
     }
     catch (const container::NoSuchElementException& )
     {}
-    m_pCurLocalizationMgr = new LocalizationMgr
-        ( this, rDocument, aLibName, xStringResourceManager );
 
+    m_pCurLocalizationMgr = boost::shared_ptr<LocalizationMgr>(new LocalizationMgr(this, rDocument, aLibName, xStringResourceManager));
     m_pCurLocalizationMgr->handleTranslationbar();
 }
 
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index d41ed42..eb16d60 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -85,10 +85,8 @@ namespace {
     }
 }
 
-ManageLanguageDialog::ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) :
-
+ManageLanguageDialog::ManageLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr ) :
     ModalDialog( pParent, IDEResId( RID_DLG_MANAGE_LANGUAGE ) ),
-
     m_aLanguageFT       ( this, IDEResId( FT_LANGUAGE ) ),
     m_aLanguageLB       ( this, IDEResId( LB_LANGUAGE ) ),
     m_aAddPB            ( this, IDEResId( PB_ADD_LANG ) ),
@@ -290,10 +288,9 @@ IMPL_LINK( ManageLanguageDialog, SelectHdl, ListBox *, EMPTYARG )
 
 // class SetDefaultLanguageDialog -----------------------------------------------
 
-SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) :
+SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr ) :
 
     ModalDialog( pParent, IDEResId( RID_DLG_SETDEF_LANGUAGE ) ),
-
     m_aLanguageFT   ( this, IDEResId( FT_DEF_LANGUAGE ) ),
     m_pLanguageLB   ( new SvxLanguageBox( this, IDEResId( LB_DEF_LANGUAGE ) ) ),
     m_pCheckLangLB  ( NULL ),
@@ -302,9 +299,7 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, Localizatio
     m_aOKBtn        ( this, IDEResId( PB_DEF_OK ) ),
     m_aCancelBtn    ( this, IDEResId( PB_DEF_CANCEL ) ),
     m_aHelpBtn      ( this, IDEResId( PB_DEF_HELP ) ),
-
     m_pLocalizationMgr( _pLMgr )
-
 {
     if ( m_pLocalizationMgr->isLibraryLocalized() )
     {
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 0f09c45..3f1b757 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -85,7 +85,7 @@ friend class LocalizationMgr;
     IDEBaseWindow*      pCurWin;
     ScriptDocument      m_aCurDocument;
     ::rtl::OUString     m_aCurLibName;
-    LocalizationMgr*    m_pCurLocalizationMgr;
+    boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
 
     ScrollBar           aHScrollBar;
     ScrollBar           aVScrollBar;
@@ -177,7 +177,7 @@ public:
                         GetCurDocument() const { return m_aCurDocument; }
     const ::rtl::OUString&       GetCurLibName() const { return m_aCurLibName; }
     ObjectCatalog*      GetObjectCatalog() const    { return pObjectCatalog; }
-    LocalizationMgr*    GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
+    boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
 
     ScrollBar&          GetHScrollBar()         { return aHScrollBar; }
     ScrollBar&          GetVScrollBar()         { return aVScrollBar; }
diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx
index f9f9dba..3ff9db6 100644
--- a/basctl/source/inc/managelang.hxx
+++ b/basctl/source/inc/managelang.hxx
@@ -68,7 +68,7 @@ private:
     HelpButton          m_aHelpBtn;
     OKButton            m_aCloseBtn;
 
-    LocalizationMgr*    m_pLocalizationMgr;
+    boost::shared_ptr<LocalizationMgr> m_pLocalizationMgr;
 
     ::rtl::OUString     m_sDefLangStr;
     ::rtl::OUString     m_sDeleteStr;
@@ -85,7 +85,7 @@ private:
     DECL_LINK(          SelectHdl, ListBox * );
 
 public:
-    ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr );
+    ManageLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr );
     ~ManageLanguageDialog();
 };
 
@@ -103,13 +103,13 @@ private:
     HelpButton          m_aHelpBtn;
 
     bool                m_bIsDefaultMode;
-    LocalizationMgr*    m_pLocalizationMgr;
+    boost::shared_ptr<LocalizationMgr> m_pLocalizationMgr;
 
     void                FillLanguageBox();
     void                CalcInfoSize();
 
 public:
-    SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr );
+    SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr );
     ~SetDefaultLanguageDialog();
 
     ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale >   GetLocales() const;
commit e0d20cbd0b3ac2ef3590d82ee5d75785ac5401fe
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 20 20:09:39 2012 -0500

    valgrind: Fix memory leak

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index ac45989..4aabe00 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -245,6 +245,7 @@ BasicIDEShell::~BasicIDEShell()
     SetWindow( 0 );
     SetCurWindow( 0 );
 
+    delete m_pCurLocalizationMgr;
 
     IDEBaseWindow* pWin = aIDEWindowTable.First();
     while ( pWin )
commit 9f1ee3e585a04154b49d0592c7c541527cfcd79d
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 20 19:32:21 2012 -0500

    Remove useless macros

diff --git a/basic/inc/basic/sbxmeth.hxx b/basic/inc/basic/sbxmeth.hxx
index 363da1b..23d8923 100644
--- a/basic/inc/basic/sbxmeth.hxx
+++ b/basic/inc/basic/sbxmeth.hxx
@@ -48,16 +48,9 @@ public:
     virtual SbxClassType GetClass() const;
 };
 
-#ifndef __SBX_SBXMETHODREF_HXX
-#define __SBX_SBXMETHODREF_HXX
-
-#ifndef SBX_METHOD_DECL_DEFINED
-#define SBX_METHOD_DECL_DEFINED
 SV_DECL_REF(SbxMethod)
-#endif
 SV_IMPL_REF(SbxMethod)
 
 #endif
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list