framework/source/accelerators/acceleratorconfiguration.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
New commits: commit 7da503470666bbcf2062e60fd4796f7316ac14f8 Author: Neil Roberts <[email protected]> AuthorDate: Mon Sep 15 14:43:12 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Sep 19 10:57:15 2025 +0200 AcceleratorConfiguration: Don’t ignore changes that don’t have a command The XCUBasedAcceleratorConfiguraton reloads the configuration for a key when a change notification on that key is received. However if the change event was triggered by deleting a key then the change path doesn’t contain a command and the code was ignoring it. The reloadChanged function seems to already almost be designed to handle the case when there is no command in the configuration. In that case it deletes the key which seems like the right thing to do. However, when a new key is assigned an event first gets fired for the key with no locale, so the code needs to additionally handle that case now. I don’t think this has any practical implications unless it’s possible to have two instances of an XCUBasedAcceleratorConfiguration for the same module open at the same time. However, this patch alone can work as an alternative way to fix the problem described in 96491f3f842bb911aca62e74d29865c3f36618e8 because it would cause the deleted key from the module config to also be deleted in the global config. It looks like the check for sPath was added in 7492878a15774e9741ea2fefbf183fbec557c1c1. Change-Id: Ia90a1932e3169ca28157482c3035aba7efae012a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190972 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 34fe76b3849b..27848a17f6ae 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -918,7 +918,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util: if ( sGlobalModules == CFG_ENTRY_GLOBAL ) { sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath); - if ( !sKey.isEmpty() && !sPath.isEmpty() ) + if ( !sKey.isEmpty() ) reloadChanged(sPrimarySecondary, sGlobalModules, OUString(), sKey); } else if ( sGlobalModules == CFG_ENTRY_MODULES ) @@ -926,7 +926,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util: OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath, &sPath); sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath); - if ( !sKey.isEmpty() && !sPath.isEmpty() ) + if ( !sKey.isEmpty() ) { reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey); } @@ -1247,7 +1247,8 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const OUString& sPrimarySe OUString sLocale = impl_ts_getLocale(); xContainer->getByName(sKey) >>= xKey; xKey->getByName(CFG_PROP_COMMAND) >>= xCommand; - xCommand->getByName(sLocale) >>= sCommand; + if (xCommand->hasByName(sLocale)) + xCommand->getByName(sLocale) >>= sCommand; } if ( sPrimarySecondary == CFG_ENTRY_PRIMARY )
