summaryrefslogtreecommitdiff
path: root/framework/source/layoutmanager
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-02 15:07:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-02 16:50:07 +0000
commit0c622c988523da4edc68d68ca4f4358c1fef83e4 (patch)
treec6130d06fa3719a07ea0cc32acef6ef42bfb4a74 /framework/source/layoutmanager
parent16a87cb29ec007ae7bed8d4116f1d6e3dd36a175 (diff)
extra menubar displayed after exiting embedded object edit
when using native gtk3 menubars. The issue is that MenuBarManager does not own its MenuBar. And in this embedded menubar situation a new menubar is newed and passed to m_pInplaceMenuBar but nothing destroys it. Now with native gtk3 menubars this becomes obvious as the native menubar stays behind, while in the non-native case the old menubar is replaced by the new one so while it still leaks the menubar you don't see it. Change-Id: Id732cb66664a71efc471d7bad35f4de890e1017e
Diffstat (limited to 'framework/source/layoutmanager')
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx57
1 files changed, 46 insertions, 11 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index c89a5775460e..737f36790bfb 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -210,12 +210,18 @@ void LayoutManager::impl_clearUpMenuBar()
}
// reset inplace menubar manager
- m_pInplaceMenuBar = nullptr;
+ Menu *pMenuBar = nullptr;
+ if (m_pInplaceMenuBar)
+ {
+ pMenuBar = m_pInplaceMenuBar->GetMenuBar();
+ m_pInplaceMenuBar = nullptr;
+ }
if ( m_xInplaceMenuBar.is() )
{
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
+ delete pMenuBar;
Reference< XComponent > xComp( m_xMenuBar, UNO_QUERY );
if ( xComp.is() )
@@ -1150,10 +1156,19 @@ throw (uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
// Reset old inplace menubar!
- m_pInplaceMenuBar = nullptr;
- if ( m_xInplaceMenuBar.is() )
+ Menu *pOldMenuBar = nullptr;
+ if (m_pInplaceMenuBar)
+ {
+ pOldMenuBar = m_pInplaceMenuBar->GetMenuBar();
+ m_pInplaceMenuBar = nullptr;
+ }
+ if (m_xInplaceMenuBar.is())
+ {
m_xInplaceMenuBar->dispose();
- m_xInplaceMenuBar.clear();
+ m_xInplaceMenuBar.clear();
+ }
+ delete pOldMenuBar;
+
m_bInplaceMenuSet = false;
if ( m_xFrame.is() && m_xContainerWindow.is() )
@@ -1201,10 +1216,18 @@ throw (uno::RuntimeException)
}
// Remove inplace menu bar
- m_pInplaceMenuBar = nullptr;
- if ( m_xInplaceMenuBar.is() )
+ Menu *pMenuBar = nullptr;
+ if (m_pInplaceMenuBar)
+ {
+ pMenuBar = m_pInplaceMenuBar->GetMenuBar();
+ m_pInplaceMenuBar = nullptr;
+ }
+ if (m_xInplaceMenuBar.is())
+ {
m_xInplaceMenuBar->dispose();
- m_xInplaceMenuBar.clear();
+ m_xInplaceMenuBar.clear();
+ }
+ delete pMenuBar;
}
void SAL_CALL LayoutManager::attachFrame( const Reference< XFrame >& xFrame )
@@ -2807,12 +2830,18 @@ throw( RuntimeException, std::exception )
implts_destroyElements();
impl_clearUpMenuBar();
m_xMenuBar.clear();
- if ( m_xInplaceMenuBar.is() )
+ Menu *pMenuBar = nullptr;
+ if (m_pInplaceMenuBar)
{
+ pMenuBar = m_pInplaceMenuBar->GetMenuBar();
m_pInplaceMenuBar = nullptr;
+ }
+ if (m_xInplaceMenuBar.is())
+ {
m_xInplaceMenuBar->dispose();
+ m_xInplaceMenuBar.clear();
}
- m_xInplaceMenuBar.clear();
+ delete pMenuBar;
m_xContainerWindow.clear();
m_xContainerTopWindow.clear();
@@ -2865,12 +2894,18 @@ throw( RuntimeException, std::exception )
}
impl_clearUpMenuBar();
m_xMenuBar.clear();
- if ( m_xInplaceMenuBar.is() )
+ Menu *pMenuBar = nullptr;
+ if (m_pInplaceMenuBar)
{
+ pMenuBar = m_pInplaceMenuBar->GetMenuBar();
m_pInplaceMenuBar = nullptr;
+ }
+ if (m_xInplaceMenuBar.is())
+ {
m_xInplaceMenuBar->dispose();
+ m_xInplaceMenuBar.clear();
}
- m_xInplaceMenuBar.clear();
+ delete pMenuBar;
m_xContainerWindow.clear();
m_xContainerTopWindow.clear();
}