basegfx/source/polygon/b2dpolygontools.cxx | 18 ++++++++++++------ sw/inc/viscrs.hxx | 2 +- sw/source/core/crsr/viscrs.cxx | 10 ++++------ 3 files changed, 17 insertions(+), 13 deletions(-)
New commits: commit d5a3cd6f12372f1216ad1945855f4992033ecb0a Author: Caolán McNamara <[email protected]> AuthorDate: Sat Nov 29 20:02:39 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Nov 30 12:51:46 2025 +0100 cid#1664877 Division or modulo by float zero in the unlikely case that fLength was 0f, then while we might (float) divide by it and get some junk value, we multiply that by fLength of 0f anyway so it would be a no-op cid#1664878 Division or modulo by float zero cid#1664879 Division or modulo by float zero cid#1659880 Division or modulo by float zero Change-Id: I8a0bf9f04975af252e59f9e15247871f915c8037 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194829 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index a157dedc4c7a..d03994a3da70 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -535,9 +535,12 @@ namespace basegfx::utils // handle fDistance < 0.0 if(rCandidate.isClosed()) { - // if fDistance < 0.0 increment with multiple of fLength - sal_uInt32 nCount(sal_uInt32(-fDistance / fLength)); - fDistance += double(nCount + 1) * fLength; + if (fLength != 0) + { + // if fDistance < 0.0 increment with multiple of fLength + sal_uInt32 nCount(sal_uInt32(-fDistance / fLength)); + fDistance += double(nCount + 1) * fLength; + } } else { @@ -551,9 +554,12 @@ namespace basegfx::utils // handle fDistance >= fLength if(rCandidate.isClosed()) { - // if fDistance >= fLength decrement with multiple of fLength - sal_uInt32 nCount(sal_uInt32(fDistance / fLength)); - fDistance -= static_cast<double>(nCount) * fLength; + if (fLength != 0) + { + // if fDistance >= fLength decrement with multiple of fLength + sal_uInt32 nCount(sal_uInt32(fDistance / fLength)); + fDistance -= static_cast<double>(nCount) * fLength; + } } else { commit dbe29bc354105314e83edf7069ba34caf73956eb Author: Gülşah Köse <[email protected]> AuthorDate: Fri Oct 10 11:21:07 2025 +0300 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Nov 30 12:51:35 2025 +0100 Revert "Prevent cursor invalidation if the cursor position doesn't change." This reverts commit a260cc52b2fae1382805b4389c95f29ed8671f42. This commit causes the view jump on writer. This commit originally merged for the following issue Open two writer documents side by side includes hyperlink Click the hyperilnk one of them and see hyperlink popup Type into the other document There was a glich on hyperlink popup in the first document Issue doesn't exist even without this patch. So we remove it completely. Change-Id: I8a341d66a963ed1943d9f666ba026d7eca240f08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192157 Reviewed-by: Szymon Kłos <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193082 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 9fa0abfca050..66c7df3387bb 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -63,7 +63,7 @@ public: bool IsVisible() const { return m_bIsVisible; } void SetDragCursor( bool bFlag = true ) { m_bIsDragCursor = bFlag; } - ::std::pair<SwRect, bool> SetPos(); + SwRect SetPos(); void SetPosAndShow(SfxViewShell const * pViewShell); const vcl::Cursor& GetTextCursor() const; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 159bce3f2aa3..3ddcd9999a31 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -142,7 +142,7 @@ OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink) } -::std::pair<SwRect, bool> SwVisibleCursor::SetPos() +SwRect SwVisibleCursor::SetPos() { SwRect aRect; tools::Long nTmpY = m_rState.m_aCursorHeight.getY(); @@ -214,16 +214,14 @@ OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink) m_pCursorShell->IsSelection() ) aRect.Width( 0 ); - bool bIsCursorPosChanged = m_aTextCursor.GetPos() != aRect.Pos(); - m_aTextCursor.SetSize( aRect.SSize() ); m_aTextCursor.SetPos( aRect.Pos() ); - return { aRect, bIsCursorPosChanged }; + return aRect; } void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) { - auto const [aRect, bIsCursorPosChanged] {SetPos()}; + const SwRect aRect = SetPos(); if (SfxViewShell* pNotifyViewShell = comphelper::LibreOfficeKit::isActive() ? m_pCursorShell->GetSfxViewShell() : nullptr) { @@ -255,7 +253,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) LOK_CALLBACK_INVALIDATE_VIEW_CURSOR); } } - else if ( bIsCursorPosChanged || m_pCursorShell->IsTableMode()) + else { SfxLokHelper::notifyUpdatePerViewId(*pNotifyViewShell, SfxViewShell::Current(), *pNotifyViewShell, LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);
