diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-26 20:18:03 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-08-27 10:38:23 +0200 |
commit | 0a083eb3c644447ea2cb9664cae0ea40ade52aa1 (patch) | |
tree | 34ad80c25fa7ab024f5a273e79d9728b7c49bf2e | |
parent | fee42049da6b1cf4c7f25eccd256e307cdbcdcbf (diff) |
cid#1608206 Double lock
Change-Id: I162e10b672277c77a7e0591b532d9197a79fc6d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172408
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | framework/source/uielement/recentfilesmenucontroller.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index cae2900576f0..31b65b66a6c6 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -98,6 +98,7 @@ private: virtual void impl_setPopupMenu() override; void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); void executeEntry( sal_Int32 nIndex ); + void executeEntryImpl(std::unique_lock<std::mutex>& rGuard, sal_Int32 nIndex); std::vector<std::pair<OUString, bool>> m_aRecentFilesItems; bool m_bDisabled : 1; @@ -323,7 +324,7 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > } } -void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) +void RecentFilesMenuController::executeEntryImpl(std::unique_lock<std::mutex>& rGuard, sal_Int32 nIndex) { if (( nIndex < 0 ) || ( nIndex >= sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() ))) @@ -343,7 +344,13 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) aArgsList.realloc(aArgsList.size()+1); aArgsList.getArray()[aArgsList.size()-1] = comphelper::makePropertyValue(u"ReadOnly"_ustr, true); } - dispatchCommand(m_aRecentFilesItems[nIndex].first, aArgsList, u"_default"_ustr); + dispatchCommandImpl(rGuard, m_aRecentFilesItems[nIndex].first, aArgsList, u"_default"_ustr); +} + +void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) +{ + std::unique_lock aLock(m_aMutex); + executeEntryImpl(aLock, nIndex); } // XEventListener @@ -463,7 +470,7 @@ void SAL_CALL RecentFilesMenuController::dispatch( aEntryArg = aURL.Complete.subView( nEntryPos, nAddArgs-nEntryPos ); sal_Int32 nEntry = o3tl::toInt32(aEntryArg); - executeEntry( nEntry ); + executeEntryImpl(aLock, nEntry); } } |