diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 09:56:39 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:46:35 +0200 |
commit | 335f7fa8c2ef418df7010dd996a2a32bbbdff459 (patch) | |
tree | 4810a563b4d06a03142667eb670c80751036da97 /framework/source/layoutmanager | |
parent | bb157a42865a2d591f378577c4cfb7c731e18a08 (diff) |
sb140: #i116786# use auto_ptr to track member lifetime
improves over similar 787b86549305cf0e5fdea28581b1a40f8ed3ef3d "fix leak"
Diffstat (limited to 'framework/source/layoutmanager')
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 14 | ||||
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.hxx | 5 |
2 files changed, 8 insertions, 11 deletions
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 247b1e56c8a2..89766cafa865 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -71,8 +71,6 @@ ToolbarLayoutManager::ToolbarLayoutManager( m_xUIElementFactoryManager( xUIElementFactory ), m_pParentLayouter( pParentLayouter ), m_eDockOperation( DOCKOP_ON_COLROW ), - m_pAddonOptions( 0 ), - m_pGlobalSettings( 0 ), m_bComponentAttached( false ), m_bMustLayout( false ), m_bLayoutDirty( false ), @@ -97,8 +95,6 @@ ToolbarLayoutManager::ToolbarLayoutManager( ToolbarLayoutManager::~ToolbarLayoutManager() { - delete m_pGlobalSettings; - delete m_pAddonOptions; } //--------------------------------------------------------------------------------------------------------- @@ -973,8 +969,8 @@ rtl::OUString ToolbarLayoutManager::implts_generateGenericAddonToolbarTitle( sal void ToolbarLayoutManager::implts_createAddonsToolBars() { WriteGuard aWriteLock( m_aLock ); - if ( !m_pAddonOptions ) - m_pAddonOptions = new AddonsOptions; + if ( m_pAddonOptions.get() == 0 ) + m_pAddonOptions.reset( new AddonsOptions ); uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); uno::Reference< frame::XFrame > xFrame( m_xFrame ); @@ -1587,12 +1583,12 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString& aWriteLock.lock(); bool bGlobalSettings( m_bGlobalSettings ); GlobalSettings* pGlobalSettings( 0 ); - if ( m_pGlobalSettings == 0 ) + if ( m_pGlobalSettings.get() == 0 ) { - m_pGlobalSettings = new GlobalSettings( m_xSMGR ); + m_pGlobalSettings.reset( new GlobalSettings( m_xSMGR ) ); bGetSettingsState = true; } - pGlobalSettings = m_pGlobalSettings; + pGlobalSettings = m_pGlobalSettings.get(); aWriteLock.unlock(); try diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index 16a42b99bd1d..993ced8ffa61 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -35,6 +35,7 @@ /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble with solaris headers ... */ +#include <memory> #include <vector> //_________________________________________________________________________________________________________________ @@ -319,8 +320,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a Rectangle m_aDockingAreaOffsets; DockingOperation m_eDockOperation; - AddonsOptions* m_pAddonOptions; - GlobalSettings* m_pGlobalSettings; + std::auto_ptr< AddonsOptions > m_pAddonOptions; + std::auto_ptr< GlobalSettings > m_pGlobalSettings; bool m_bComponentAttached; bool m_bMustLayout; |