diff options
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 11 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index b770fd8a86e0..2e28756a7bd0 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -506,6 +506,17 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) SolarMutexClearableGuard aWriteLock; UIElement& rElement = impl_findToolbar( rResourceURL ); + if (rElement.m_xUIElement.is()) + { + // somebody else must have created it while we released + // the SolarMutex - just dispose our new instance and + // do nothing. (We have to dispose either the new or the + // existing m_xUIElement.) + aWriteLock.clear(); + uno::Reference<lang::XComponent> const xC(xUIElement, uno::UNO_QUERY); + xC->dispose(); + return false; + } if ( !rElement.m_aName.isEmpty() ) { // Reuse a local entry so we are able to use the latest diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4c330b3e64ce..489ad878715a 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -200,7 +200,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, ToolBarManager::~ToolBarManager() { assert(!m_aAsyncUpdateControllersTimer.IsActive()); - OSL_ASSERT( !m_pToolBar ); + assert(!m_pToolBar); // must be disposed by ToolbarLayoutManager OSL_ASSERT( !m_bAddedToTaskPaneList ); } |