svx/source/svdraw/svdhdl.cxx                         |  101 +++++++++----------
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx |    5 
 2 files changed, 56 insertions(+), 50 deletions(-)

New commits:
commit 5572a3fe4f567f9167efe2d291af5d7d1c414d9e
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Feb 19 16:46:53 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Feb 22 21:22:13 2024 +0100

    sw: fix crash in SwSpellDialogChildWindow::LockFocusNotification()
    
    Crashreport signature:
    
            Fatal signal received: SIGSEGV code: 128 for address: 0x0
            program/libswlo.so
                    SwSpellDialogChildWindow::GetNextWrongSentence(bool)
                            
sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx:824
            program/libcuilo.so
                    
svx::SpellDialog::GetNextSentence_Impl(std::unique_ptr<UndoChangeGroupGuard, 
std::default_delete<UndoChangeGroupGuard> >*, bool, bool)
                            
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_vector.h:919
            program/libcuilo.so
                    
svx::SpellDialog::SpellContinue_Impl(std::unique_ptr<UndoChangeGroupGuard, 
std::default_delete<UndoChangeGroupGuard> >*, bool, bool)
                            cui/source/dialogs/SpellDialog.cxx:370
            /opt/collaboraoffice/program/libcuilo.so
                    svx::SpellDialog::InitHdl(void*)
                            
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173
    
    Change-Id: I0ecae218beb30e5136f7a6f468e3eb9f6e6e5009
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163637
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit d505b8d2730b93cea8d2dcf2656af37c6c8cc580)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163615
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit f6aa72589e0f20694c58af7a098558adb5c02abc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163627
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx 
b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 5af09a6adf52..869a0fba0025 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -821,6 +821,11 @@ bool 
SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, svx::SpellPor
 
 void SwSpellDialogChildWindow::LockFocusNotification(bool bLock)
 {
+    if (!m_pSpellState)
+    {
+        return;
+    }
+
     OSL_ENSURE(m_pSpellState->m_bLockFocus != bLock, "invalid locking - no 
change of state");
     m_pSpellState->m_bLockFocus = bLock;
 }
commit 5bd591dc06f174486a75991e785ae95fd99382c8
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Feb 12 12:54:06 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Feb 22 21:21:58 2024 +0100

    tdf#159666 Crash when table and line object are selected at the same time
    
    before
        commit e3077168072452fb8f1c0a8afb2992877cb96d1c
        Author: Noel Grandin <noel.gran...@collabora.co.uk>
        Date:   Thu Jun 17 09:49:37 2021 +0200
        loplugin:finalclasses
    the cast in
       const SdrEdgeObj* pEdge = static_cast<SdrEdgeObj*>(m_pObj);
    would incorrectly cast a SdrTableObj, but it happened to do nothing
    problematic.
    
    After the above commit, the vtable layout changed and it started
    crashing.
    
    Work around it by use dynamic_cast and ignoring objects that are not
    SdrEdgeObj.
    
    Change-Id: Ibe03d4935b8eeb182e037b1648d841e26fa23ed4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163242
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit bac09f76fd903c109b591a7bc15883e5653715ee)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163187
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 12b25cb35eb9cbb08363f4bd45e9190d3ef674b5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163270
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 867afa6a90b8..c8f1fa3159b7 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1604,66 +1604,67 @@ ImpEdgeHdl::~ImpEdgeHdl()
 
 void ImpEdgeHdl::CreateB2dIAObject()
 {
-    if(m_nObjHdlNum <= 1 && m_pObj)
+    if(m_nObjHdlNum > 1 || !m_pObj)
     {
-        // first throw away old one
-        GetRidOfIAObject();
+        // call parent
+        SdrHdl::CreateB2dIAObject();
+        return;
+    }
 
-        BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
-        BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+    // first throw away old one
+    GetRidOfIAObject();
 
-        if(m_pHdlList)
-        {
-            SdrMarkView* pView = m_pHdlList->GetView();
+    BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
+    BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
 
-            if(pView && !pView->areMarkHandlesHidden())
-            {
-                const SdrEdgeObj* pEdge = static_cast<SdrEdgeObj*>(m_pObj);
+    if(!m_pHdlList)
+        return;
 
-                if(pEdge->GetConnectedNode(m_nObjHdlNum == 0) != nullptr)
-                    eColIndex = BitmapColorIndex::LightRed;
+    SdrMarkView* pView = m_pHdlList->GetView();
 
-                if(m_nPPntNum < 2)
-                {
-                    // Handle with plus sign inside
-                    eKindOfMarker = BitmapMarkerKind::Circ_7x7;
-                }
+    if(!pView || pView->areMarkHandlesHidden())
+        return;
 
-                SdrPageView* pPageView = pView->GetSdrPageView();
+    // tdf#159666 Crash when table and line object are selected at the same 
time
+    auto pEdge = dynamic_cast<SdrEdgeObj*>(m_pObj);
+    if (!pEdge)
+        return;
 
-                if(pPageView)
-                {
-                    for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
-                    {
-                        const SdrPageWindow& rPageWindow = 
*pPageView->GetPageWindow(b);
-
-                        if(rPageWindow.GetPaintWindow().OutputToWindow())
-                        {
-                            const rtl::Reference< sdr::overlay::OverlayManager 
>& xManager = rPageWindow.GetOverlayManager();
-                            if (xManager.is())
-                            {
-                                basegfx::B2DPoint aPosition(m_aPos.X(), 
m_aPos.Y());
-                                std::unique_ptr<sdr::overlay::OverlayObject> 
pNewOverlayObject(CreateOverlayObject(
-                                    aPosition,
-                                    eColIndex,
-                                    eKindOfMarker));
-
-                                // OVERLAYMANAGER
-                                insertNewlyCreatedOverlayObjectForSdrHdl(
-                                    std::move(pNewOverlayObject),
-                                    rPageWindow.GetObjectContact(),
-                                    *xManager);
-                            }
-                        }
-                    }
-                }
-            }
-        }
+    if(pEdge->GetConnectedNode(m_nObjHdlNum == 0) != nullptr)
+        eColIndex = BitmapColorIndex::LightRed;
+
+    if(m_nPPntNum < 2)
+    {
+        // Handle with plus sign inside
+        eKindOfMarker = BitmapMarkerKind::Circ_7x7;
     }
-    else
+
+    SdrPageView* pPageView = pView->GetSdrPageView();
+    if(!pPageView)
+        return;
+
+    for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
     {
-        // call parent
-        SdrHdl::CreateB2dIAObject();
+        const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+        if(rPageWindow.GetPaintWindow().OutputToWindow())
+        {
+            const rtl::Reference< sdr::overlay::OverlayManager >& xManager = 
rPageWindow.GetOverlayManager();
+            if (xManager.is())
+            {
+                basegfx::B2DPoint aPosition(m_aPos.X(), m_aPos.Y());
+                std::unique_ptr<sdr::overlay::OverlayObject> 
pNewOverlayObject(CreateOverlayObject(
+                    aPosition,
+                    eColIndex,
+                    eKindOfMarker));
+
+                // OVERLAYMANAGER
+                insertNewlyCreatedOverlayObjectForSdrHdl(
+                    std::move(pNewOverlayObject),
+                    rPageWindow.GetObjectContact(),
+                    *xManager);
+            }
+        }
     }
 }
 

Reply via email to