diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-11-07 13:43:52 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-11-07 13:43:52 +0000 |
commit | be561315478a44746f398aed1a854f901f4a4bd8 (patch) | |
tree | b71f2361471270404905fc8c0e995584ffb4561c /framework/source/uielement | |
parent | 380061a7235c4bd4150f6db4912997f4934251b9 (diff) |
INTEGRATION: CWS fwk55 (1.43.6); FILE MERGED
2006/10/20 13:27:41 cd 1.43.6.1: #i66236# Don't apply settings from item container, if menu has been opened by user
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 879780c789c8..d3ec656fc6e3 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -4,9 +4,9 @@ * * $RCSfile: menubarmanager.cxx,v $ * - * $Revision: 1.43 $ + * $Revision: 1.44 $ * - * last change: $Author: obo $ $Date: 2006-10-13 09:43:27 $ + * last change: $Author: kz $ $Date: 2006-11-07 14:43:52 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -543,6 +543,10 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const ::com::sun::star::uno::Sequenc MenuBarManager::~MenuBarManager() { + // stop asynchronous settings timer + m_xDeferedItemContainer.clear(); + m_aAsyncSettingsTimer.Stop(); + DBG_ASSERT( OWeakObject::m_refCount == 0, "Who wants to delete an object with refcount > 0!" ); } @@ -552,6 +556,11 @@ void MenuBarManager::Destroy() if ( !m_bDisposed ) { + // stop asynchronous settings timer and + // release defered item container reference + m_aAsyncSettingsTimer.Stop(); + m_xDeferedItemContainer.clear(); + std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ ) { @@ -564,7 +573,10 @@ void MenuBarManager::Destroy() m_aMenuItemHandlerVector.clear(); if ( m_bDeleteMenu ) + { delete m_pVCLMenu; + m_pVCLMenu = 0; + } } } @@ -1318,11 +1330,37 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) IMPL_LINK( MenuBarManager, Deactivate, Menu *, pMenu ) { if ( pMenu == m_pVCLMenu ) + { m_bActive = sal_False; + if ( pMenu->IsMenuBar() && m_xDeferedItemContainer.is() ) + { + // Start timer to handle settings asynchronous + // Changing the menu inside this handler leads to + // a crash under X! + m_aAsyncSettingsTimer.SetTimeoutHdl(LINK(this, MenuBarManager, AsyncSettingsHdl)); + m_aAsyncSettingsTimer.SetTimeout(10); + m_aAsyncSettingsTimer.Start(); + } + } return 1; } +IMPL_LINK( MenuBarManager, AsyncSettingsHdl, Timer*,) +{ + OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xSelfHold( + static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY_THROW ); + + m_aAsyncSettingsTimer.Stop(); + if ( !m_bActive && m_xDeferedItemContainer.is() ) + { + SetItemContainer( m_xDeferedItemContainer ); + m_xDeferedItemContainer.clear(); + } + + return 0; +} IMPL_LINK( MenuBarManager, Select, Menu *, pMenu ) { @@ -2128,6 +2166,13 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + // Check active state as we cannot change our VCL menu during activation by the user + if ( m_bActive ) + { + m_xDeferedItemContainer = rItemContainer; + return; + } + RemoveListener(); std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ ) |