sfx2/source/notebookbar/SfxNotebookBar.cxx |    8 --------
 1 file changed, 8 deletions(-)

New commits:
commit 34a285a05f7f4a315661c1267515effb8c0c812a
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Dec 7 15:47:37 2021 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Dec 8 19:18:14 2021 +0100

    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.lu...@collabora.com>

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;

Reply via email to