diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-12-07 15:47:37 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-12-08 19:18:14 +0100 |
commit | 34a285a05f7f4a315661c1267515effb8c0c812a (patch) | |
tree | fc65cdc1c1759ca17da47c6cda6aeb54226e09f7 /sfx2 | |
parent | ab99d16e21e56596803b7d9a28af0895b435ef3e (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/+/126483
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sfx2')
-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 1589e417bd69..b4cd2cec4faf 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -467,8 +467,6 @@ void SfxNotebookBar::ShowMenubar(bool bShow) if (xLayoutManager.is()) { - xLayoutManager->lock(); - if (xLayoutManager->getElement(MENUBAR_STR).is()) { if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow) @@ -476,8 +474,6 @@ void SfxNotebookBar::ShowMenubar(bool bShow) else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow) xLayoutManager->showElement(MENUBAR_STR); } - - xLayoutManager->unlock(); } } } @@ -500,8 +496,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) @@ -509,8 +503,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; |