summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-12-07 15:47:37 +0100
committerAndras Timar <andras.timar@collabora.com>2022-02-14 11:25:40 +0100
commit7217d1ba3abfffa17c330ac279130c66cc9d2ca2 (patch)
tree57bc396352e738bf6891f2fd6d9c98f1a878dda6 /sfx2
parent6c52d276c40a241153ad466fac8a0390ab3b241f (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.cxx8
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;