editeng/source/editeng/impedit.cxx |    4 ++--
 include/sfx2/lokhelper.hxx         |    2 +-
 sfx2/source/view/lokhelper.cxx     |    7 +++----
 3 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 740c6580d6ec3efbc7abcfa12c56405675c758dc
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jul 23 19:25:56 2025 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jul 29 09:00:15 2025 +0200

    SfxLokHelper::notifyOtherView can take ref for first arg
    
    because it calls lcl_generateJSON which derefed unconditionally
    
    Change-Id: Idad6a8ee40d34fa54f8c65f7b89f213739b16fba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188292
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index f67073380470..8f4b74544d70 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1404,7 +1404,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
             if (pOtherShell && pThisShell != pOtherShell)
             {
                 // Another shell wants to know about our existing cursor.
-                SfxLokHelper::notifyOtherView(pThisShell, pOtherShell,
+                SfxLokHelper::notifyOtherView(*pThisShell, pOtherShell,
                         LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, aMessageParams);
             }
             else
@@ -1445,7 +1445,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
                 aMessageParams.add_child("hyperlink", aHyperlinkTree);
 
                 if 
(comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation())
-                    SfxLokHelper::notifyOtherView(pThisShell, pThisShell,
+                    SfxLokHelper::notifyOtherView(*pThisShell, pThisShell,
                             LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, 
aMessageParams);
                 else
                     
pThisShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index e4b5dba73428..00f4468dcaab 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -168,7 +168,7 @@ public:
     static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell 
const* pOtherView,
                                 int nType, std::string_view rKey, const 
OString& rPayload);
     /// Same as notifyOtherViews(), the property-tree version, but works on a 
selected "other" view, not on all of them.
-    static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell 
const* pOtherView,
+    static void notifyOtherView(const SfxViewShell& rThisView, SfxViewShell 
const* pOtherView,
                                 int nType, const boost::property_tree::ptree& 
rTree);
 
     /// Emits a LOK_CALLBACK_STATE_CHANGED
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 62d63e47de56..71376cc0fa7c 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -561,15 +561,14 @@ void SfxLokHelper::notifyOtherView(const SfxViewShell* 
pThisView, SfxViewShell c
     pOtherView->libreOfficeKitViewCallbackWithViewId(nType, aPayload, viewId);
 }
 
-void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell 
const* pOtherView,
+void SfxLokHelper::notifyOtherView(const SfxViewShell& rThisView, SfxViewShell 
const* pOtherView,
                                    int nType, const 
boost::property_tree::ptree& rTree)
 {
-    assert(pThisView != nullptr && "pThisView must be valid");
     if (DisableCallbacks::disabled() || !pOtherView)
         return;
 
-    const int viewId = SfxLokHelper::getView(pThisView);
-    pOtherView->libreOfficeKitViewCallbackWithViewId(nType, 
lcl_generateJSON(*pThisView, rTree), viewId);
+    const int viewId = SfxLokHelper::getView(rThisView);
+    pOtherView->libreOfficeKitViewCallbackWithViewId(nType, 
lcl_generateJSON(rThisView, rTree), viewId);
 }
 
 void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, 
std::string_view rKey,

Reply via email to