diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-12-07 15:47:37 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-12-09 13:23:20 +0100 |
commit | 1d641165a9f632708da33d7853f88d335315dbf3 (patch) | |
tree | e7c21e305c28b95cf70a2eab595934559ddb9e2f | |
parent | ae4b61024f460af3c38eac24539f16c934698ff6 (diff) |
do not unnecessarily lock XLayoutManager for menubar changes
The XLayoutManager documentation says that lock() prohibits layout
updates until unlock() is called, so it's not any kind of mutex
or anything, it just allows grouping updates. Which means it's
useless to put around a single call to change menubar visibility.
To make things worse, unlock() will always trigger a layout,
so even if nothing changes, it still does an unnecessary layout
update. And since this gets called from SfxLokHelper::setView(),
it may get called often and it's rather costly.
Change-Id: I3e3e37b6763b15d454e76b4bef0b22f84cf479d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126445
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index dd6781ae66c3..e991ac9e6877 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -479,8 +479,6 @@ void SfxNotebookBar::ShowMenubar(bool bShow) if (xLayoutManager.is()) { - xLayoutManager->lock(); - if (xLayoutManager->getElement(MENUBAR_STR).is()) { if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow) @@ -488,8 +486,6 @@ void SfxNotebookBar::ShowMenubar(bool bShow) else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow) xLayoutManager->showElement(MENUBAR_STR); } - - xLayoutManager->unlock(); } } } @@ -512,8 +508,6 @@ void SfxNotebookBar::ShowMenubar(SfxViewFrame const * pViewFrame, bool bShow) const Reference<frame::XLayoutManager>& xLayoutManager = lcl_getLayoutManager(xFrame); if (xLayoutManager.is()) { - xLayoutManager->lock(); - if (xLayoutManager->getElement(MENUBAR_STR).is()) { if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow) @@ -521,8 +515,6 @@ void SfxNotebookBar::ShowMenubar(SfxViewFrame const * pViewFrame, bool bShow) else if (!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow) xLayoutManager->showElement(MENUBAR_STR); } - - xLayoutManager->unlock(); } } m_bLock = false; |