[Libreoffice-commits] core.git: reportdesign/source svx/source

2023-08-01 Thread Patrick Luby (via logerrit)
 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 
AuthorDate: Tue Aug 1 16:09:53 2023 +0200
Commit: Patrick Luby 
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 
Reviewed-by: Patrick Luby 

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 & p) { return p.get() == pHdl; });
+assert(it != maList.end());
 if( it == maList.end() )
 return SAL_MAX_SIZE;
 return it - maList.begin();


[Libreoffice-commits] core.git: reportdesign/source svx/source

2023-08-01 Thread Patrick Luby (via logerrit)
 reportdesign/source/ui/report/ViewsWindow.cxx |   14 ++
 svx/source/svdraw/svdhdl.cxx  |1 -
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 01a1d2a84992973b8a0e5f1ae99fd32f5913b58f
Author: Patrick Luby 
AuthorDate: Mon Jul 31 20:03:13 2023 -0400
Commit: Patrick Luby 
CommitDate: Tue Aug 1 14:27:49 2023 +0200

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.

Change-Id: I89606958f8a76a2c35685d1aff6b0159739a464a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155119
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx 
b/reportdesign/source/ui/report/ViewsWindow.cxx
index e11735bf72ca..a5ad82e818e2 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1043,7 +1043,21 @@ 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 de6ffcd8175f..3bcebf59ea26 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2282,7 +2282,6 @@ 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 & p) { return p.get() == pHdl; });
-assert(it != maList.end());
 if( it == maList.end() )
 return SAL_MAX_SIZE;
 return it - maList.begin();


[Libreoffice-commits] core.git: reportdesign/source svx/source vcl/source

2018-12-09 Thread Libreoffice Gerrit user
 reportdesign/source/ui/dlg/Navigator.cxx |4 ++--
 svx/source/form/filtnav.cxx  |4 ++--
 svx/source/form/navigatortree.cxx|4 ++--
 vcl/source/control/field.cxx |   18 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 519b3fc6ad58eb4ef8ffa6460148fb9f6e7e
Author: Andrea Gelmini 
AuthorDate: Wed Dec 5 22:20:49 2018 +0100
Commit: Julien Nabet 
CommitDate: Sun Dec 9 09:18:51 2018 +0100

Fix typos in code

It passed "make check" on Linux

Change-Id: I8cfe93e58bb5a006d69ea7420b5f2aa07a0864c2
Reviewed-on: https://gerrit.libreoffice.org/64739
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/reportdesign/source/ui/dlg/Navigator.cxx 
b/reportdesign/source/ui/dlg/Navigator.cxx
index b28fb5ed7fcb..e766a13cc6a9 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -395,8 +395,8 @@ sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& 
_rEvt )
 }
 else
 {
-SvTreeListEntry* pDropppedOn = GetEntry(aDropPos);
-if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && 
!IsExpanded(pDropppedOn))
+SvTreeListEntry* pDroppedOn = GetEntry(aDropPos);
+if (pDroppedOn && (GetChildCount(pDroppedOn) > 0) && 
!IsExpanded(pDroppedOn))
 {
 m_aDropActionType = DA_EXPANDNODE;
 bNeedTrigger = true;
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 8a30a1cab344..97e414984b12 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1228,8 +1228,8 @@ sal_Int8 FmFilterNavigator::AcceptDrop( const 
AcceptDropEvent& rEvt )
 }
 else
 {   // is it an entry with children, and not yet expanded?
-SvTreeListEntry* pDropppedOn = GetEntry(aDropPos);
-if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && 
!IsExpanded(pDropppedOn))
+SvTreeListEntry* pDroppedOn = GetEntry(aDropPos);
+if (pDroppedOn && (GetChildCount(pDroppedOn) > 0) && 
!IsExpanded(pDroppedOn))
 {
 // -> expand
 m_aDropActionType = DA_EXPANDNODE;
diff --git a/svx/source/form/navigatortree.cxx 
b/svx/source/form/navigatortree.cxx
index 555bd5c94367..bdf2a97b0aa4 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -853,8 +853,8 @@ namespace svxform
 bNeedTrigger = true;
 } else
 {   // on an entry with children, not swang open
-SvTreeListEntry* pDropppedOn = GetEntry(aDropPos);
-if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && 
!IsExpanded(pDropppedOn))
+SvTreeListEntry* pDroppedOn = GetEntry(aDropPos);
+if (pDroppedOn && (GetChildCount(pDroppedOn) > 0) && 
!IsExpanded(pDroppedOn))
 {
 // -> swing open
 m_aDropActionType = DA_EXPANDNODE;
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 7e70ddb554f6..6801c0a7a5d8 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -58,7 +58,7 @@ sal_Int64 ImplPower10( sal_uInt16 n )
 
 bool ImplNumericProcessKeyInput( const KeyEvent& rKEvt,
  bool bStrictFormat, bool bThousandSep,
- const LocaleDataWrapper& rLocaleDataWrappper )
+ const LocaleDataWrapper& rLocaleDataWrapper )
 {
 if ( !bStrictFormat )
 return false;
@@ -71,15 +71,15 @@ bool ImplNumericProcessKeyInput( const KeyEvent& rKEvt,
  (nGroup == KEYGROUP_CURSOR) ||
  (nGroup == KEYGROUP_MISC) ||
  ((cChar >= '0') && (cChar <= '9')) ||
- string::equals(rLocaleDataWrappper.getNumDecimalSep(), cChar) 
||
- (bThousandSep && 
string::equals(rLocaleDataWrappper.getNumThousandSep(), cChar)) ||
- string::equals(rLocaleDataWrappper.getNumDecimalSepAlt(), 
cChar) ||
+ string::equals(rLocaleDataWrapper.getNumDecimalSep(), cChar) 
||
+ (bThousandSep && 
string::equals(rLocaleDataWrapper.getNumThousandSep(), cChar)) ||
+ string::equals(rLocaleDataWrapper.getNumDecimalSepAlt(), 
cChar) ||
  (cChar == '-'));
 }
 }
 
 bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
- sal_uInt16 nDecDigits, const 
LocaleDataWrapper& rLocaleDataWrappper,
+ sal_uInt16 nDecDigits, const 
LocaleDataWrapper& rLocaleDataWrapper,
  bool bCurrency = false )
 {
 OUStringaStr = rStr;
@@ -98,9 +98,9 @@ bool ImplNumericGetValue( const OUString& rStr,