reportdesign/source/ui/report/ViewsWindow.cxx |   14 --------------
 svx/source/svdraw/svdhdl.cxx                  |    1 +
 2 files changed, 1 insertion(+), 14 deletions(-)

New commits:
commit 73adf93acc9bbac4c8db9aa844930629a429410e
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Tue Aug 1 16:09:53 2023 +0200
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Tue Aug 1 21:23:30 2023 +0200

    Revert "tdf#144072 prevent use of a deleted pointer"
    
    This reverts commit 01a1d2a84992973b8a0e5f1ae99fd32f5913b58f.
    
    That commit appeared to fix tdf#144072 but it only delays the crash as the 
reportdesign module will keep reusing the same SdHdl pointer that has already 
been deleted.
    
    Change-Id: I8e416b0376aa8724b697f54ed45f58341b47dc2a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155181
    Tested-by: Patrick Luby <plub...@neooffice.org>
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx 
b/reportdesign/source/ui/report/ViewsWindow.cxx
index a5ad82e818e2..e11735bf72ca 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1043,21 +1043,7 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, 
SdrHdl* _pHdl,const OSectionVi
                         "createInvisible X:" << aRect.Left() << " Y:"
                             << aRect.Top() << " on View #" << nViewCount);
 
-                    // tdf#144072 prevent use of a deleted pointer
-                    // BegDragObj_createInvisibleObjectAtPosition() may clear
-                    // the handle list and that will delete the SdrHdl 
instances
-                    // owned by this section view so set _pHdl to null if it 
has
-                    // been deleted during the call.
-                    bool bHdlInList = false;
-                    const SdrHdlList& rHdlList = rView.GetHdlList();
-                    if (_pHdl && rHdlList.GetHdlNum(_pHdl) < 
rHdlList.GetHdlCount())
-                        bHdlInList = true;
                     BegDragObj_createInvisibleObjectAtPosition(aRect, rView);
-                    if (bHdlInList && rHdlList.GetHdlNum(_pHdl) >= 
rHdlList.GetHdlCount())
-                    {
-                        SAL_WARN("reportdesign", "SdrHdl pointer parameter has 
been deleted");
-                        _pHdl = nullptr;
-                    }
                 }
             }
         }
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 3bcebf59ea26..de6ffcd8175f 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2282,6 +2282,7 @@ size_t SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
         return SAL_MAX_SIZE;
     auto it = std::find_if( maList.begin(), maList.end(),
         [&](const std::unique_ptr<SdrHdl> & p) { return p.get() == pHdl; });
+    assert(it != maList.end());
     if( it == maList.end() )
         return SAL_MAX_SIZE;
     return it - maList.begin();

Reply via email to