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

New commits:
commit 1d641165a9f632708da33d7853f88d335315dbf3
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Dec 7 15:47:37 2021 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu Dec 9 13:23:20 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/+/126445
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

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;

Reply via email to