sw/source/core/crsr/viscrs.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 925dc75dd826a8f96860072781c3048896a7fe9f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri May 16 09:09:37 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri May 16 10:27:22 2025 +0200

    crash in SwVisibleCursor::SetPosAndShow
    
    /lib64/libpthread.so.0
            __restore_rt
                    ??:?
    program/../program/libswlo.so
            SwVisibleCursor::SetPosAndShow(SfxViewShell const*)
                    sw/source/core/crsr/viscrs.cxx:224
    program/../program/libswlo.so
            SwCursorShell::UpdateCursor(unsigned short, bool)
                    sw/source/core/crsr/crsrsh.cxx:2453
    program/../program/libswlo.so
            SwCursorShell::EndAction(bool)
                    sw/source/core/crsr/crsrsh.cxx:282
    program/../program/libswlo.so
            SwRootFrame::EndAllAction()
                    sw/source/core/layout/pagechg.cxx:1994
    program/../program/libswlo.so
            
SwXMeta::AttachImpl(com::sun::star::uno::Reference<com::sun::star::text::XTextRange>
 const&, unsigned short)
                    sw/source/core/unocore/unorefmk.cxx:953
    program/../program/libswlo.so
            
com::sun::star::uno::Reference<com::sun::star::text::XTextRange>::~Reference()
                    include/com/sun/star/uno/Reference.hxx:113
    program/../program/libswlo.so
            std::vector<svx::ClassificationResult, 
std::allocator<svx::ClassificationResult> >::~vector()
                    
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:730
    program/../program/libswlo.so
            SwEditShell::SwEditShell(SwDoc&, vcl::Window*, SwViewOption const*)
                    sw/source/core/edit/edws.cxx:59
    program/../program/libswlo.so
            SwFEShell::SwFEShell(SwDoc&, vcl::Window*, SwViewOption const*)
                    sw/source/core/frmedt/fews.cxx:692
    program/../program/libswlo.so
            SwWrtShell::SwWrtShell(SwDoc&, vcl::Window*, SwView&, SwViewOption 
const*)
                    sw/source/uibase/wrtsh/wrtsh1.cxx:2044
    
    Change-Id: I3664dbaad8102526ec3b91cf11ff364fe4bf2642
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185386
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index e492544a4805..ad1fbdc16de2 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -210,7 +210,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
     m_aTextCursor.SetSize( aRect.SSize() );
     m_aTextCursor.SetPos( aRect.Pos() );
 
-    if (comphelper::LibreOfficeKit::isActive())
+    if (SfxViewShell* pNotifyViewShell = 
comphelper::LibreOfficeKit::isActive() ? m_pCursorShell->GetSfxViewShell() : 
nullptr)
     {
         // notify about page number change (if that happened)
         sal_uInt16 nPage, nVirtPage;
@@ -221,7 +221,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
         {
             m_nPageLastTime = nPage;
             OString aPayload = OString::number(nPage - 1);
-            
m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART,
 aPayload);
+            
pNotifyViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload);
         }
 
         // This may get called often, so instead of sending data on each 
update, just notify
@@ -230,21 +230,21 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
         m_aLastLOKRect = aRect;
         if (pViewShell)
         {
-            if (pViewShell == m_pCursorShell->GetSfxViewShell())
+            if (pViewShell == pNotifyViewShell)
             {
                 SfxLokHelper::notifyUpdatePerViewId(pViewShell, 
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
             }
             else
             {
-                SfxLokHelper::notifyUpdatePerViewId(pViewShell, 
m_pCursorShell->GetSfxViewShell(), pViewShell,
+                SfxLokHelper::notifyUpdatePerViewId(pViewShell, 
pNotifyViewShell, pViewShell,
                     LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
             }
         }
         else if ( bIsCursorPosChanged || m_pCursorShell->IsTableMode())
         {
-            
SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), 
SfxViewShell::Current(),
-                m_pCursorShell->GetSfxViewShell(), 
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
-            
SfxLokHelper::notifyOtherViewsUpdatePerViewId(m_pCursorShell->GetSfxViewShell(),
 LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
+            SfxLokHelper::notifyUpdatePerViewId(pNotifyViewShell, 
SfxViewShell::Current(),
+                pNotifyViewShell, LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
+            SfxLokHelper::notifyOtherViewsUpdatePerViewId(pNotifyViewShell, 
LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
         }
     }
 

Reply via email to