desktop/source/lib/init.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 6a1aa5ba0be05258b6375433a071389811efd405
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Sat Sep 25 21:26:31 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Sep 28 13:46:55 2021 +0200

    do not check a const variable in every lambda invocation
    
    If the variable is false, then every call to the lambda will be false
    as well, so the entire block may be skipped.
    
    Change-Id: I8b61133d246fcfa721145f9d28c55e9afdb06e5d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122678
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 267d54492d14..0677c0ccc5e7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1606,11 +1606,14 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
                 const bool hyperLinkException = type == 
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR &&
                     payload.find("\"hyperlink\":\"\"") == std::string::npos &&
                     payload.find("\"hyperlink\": {}") == std::string::npos;
-                const int nViewId = lcl_getViewId(payload);
-                removeAll(type, [nViewId, hyperLinkException] (const 
CallbackData& elemData) {
-                        return (nViewId == lcl_getViewId(elemData) && 
!hyperLinkException);
-                    }
-                );
+                if(!hyperLinkException)
+                {
+                    const int nViewId = lcl_getViewId(payload);
+                    removeAll(type, [nViewId] (const CallbackData& elemData) {
+                            return (nViewId == lcl_getViewId(elemData));
+                        }
+                    );
+                }
             }
             break;
 

Reply via email to