[Libreoffice-commits] core.git: basctl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 19:31:37 UTC 2018


 basctl/source/basicide/brkdlg.cxx |   19 ++++++++++++-------
 basctl/source/basicide/brkdlg.hxx |    2 +-
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 0bafa88ce38bc9f6735d8118e544aa9232cc840c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 16 14:02:25 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 16 21:31:12 2018 +0200

    td#f119300 crash in Manage BreakPoints dialog
    
    regression from
        commit 4b5699bff586dd923123fbfd949c9bf03e491ed7
        loplugin:useuniqueptr in BreakPointList
    
    Change-Id: Ia95a1a15563b1664de938fad7c6435fc82ebf04c
    Reviewed-on: https://gerrit.libreoffice.org/59170
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 3563e5734118..53be6215bd78 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -24,6 +24,7 @@
 #include <basidesh.hxx>
 
 #include <sfx2/dispatch.hxx>
+#include <vcl/lstbox.hxx>
 
 namespace basctl
 {
@@ -153,8 +154,9 @@ void BreakPointDialog::CheckButtons()
 IMPL_LINK( BreakPointDialog, CheckBoxHdl, Button *, pButton, void )
 {
     ::CheckBox * pChkBx = static_cast<::CheckBox*>(pButton);
-    BreakPoint& rBrk = GetSelectedBreakPoint();
-    rBrk.bEnabled = pChkBx->IsChecked();
+    BreakPoint* pBrk = GetSelectedBreakPoint();
+    if (pBrk)
+        pBrk->bEnabled = pChkBx->IsChecked();
 }
 
 IMPL_LINK( BreakPointDialog, ComboBoxHighlightHdl, ComboBox&, rBox, void )
@@ -175,8 +177,9 @@ IMPL_LINK( BreakPointDialog, EditModifyHdl, Edit&, rEdit, void )
         CheckButtons();
     else if (&rEdit == m_pNumericField)
     {
-        BreakPoint& rBrk = GetSelectedBreakPoint();
-        rBrk.nStopAfter = rEdit.GetText().toInt32();
+        BreakPoint* pBrk = GetSelectedBreakPoint();
+        if (pBrk)
+            pBrk->nStopAfter = rEdit.GetText().toInt32();
     }
 }
 
@@ -234,10 +237,12 @@ void BreakPointDialog::UpdateFields( BreakPoint const & rBrk )
 }
 
 
-BreakPoint& BreakPointDialog::GetSelectedBreakPoint()
+BreakPoint* BreakPointDialog::GetSelectedBreakPoint()
 {
-    size_t nEntry = m_pComboBox->GetEntryPos( m_pComboBox->GetText() );
-    return m_aModifiedBreakPointList.at( nEntry );
+    sal_Int32 nEntry = m_pComboBox->GetEntryPos( m_pComboBox->GetText() );
+    if (nEntry == LISTBOX_ENTRY_NOTFOUND)
+        return nullptr;
+    return &m_aModifiedBreakPointList.at( nEntry );
 }
 
 } // namespace basctl
diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx
index ab797a20699c..f4cd8f684f94 100644
--- a/basctl/source/basicide/brkdlg.hxx
+++ b/basctl/source/basicide/brkdlg.hxx
@@ -46,7 +46,7 @@ class BreakPointDialog final : public ModalDialog
     DECL_LINK( EditModifyHdl, Edit&, void );
     DECL_LINK( ButtonHdl, Button*, void );
     void            UpdateFields( BreakPoint const & rBrk );
-    BreakPoint&     GetSelectedBreakPoint();
+    BreakPoint*     GetSelectedBreakPoint();
 
 
 public:


More information about the Libreoffice-commits mailing list