[Libreoffice-commits] core.git: sd/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Dec 4 07:10:50 UTC 2020
sd/source/ui/dlg/sdtreelb.cxx | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
New commits:
commit 986952dd52861563006d0ba178e8bdd44247af81
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu Dec 3 17:57:18 2020 -0900
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 4 08:09:30 2020 +0100
tdf#34828 sd navigator: fix crash when page item entry is selected
Page items in the tree are given user data value 1. Drawing obect items
are given user data value of the object pointer they represent. Need to
check that the user data is not 1 before casting to an object pointer.
Change-Id: I58109e556268e805f62ad2f16b363411e4341d2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107185
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 12ba6be2cf45..ed84546be179 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -702,15 +702,23 @@ void SdPageObjsTLV::Select()
if (m_bSelectionHandlerNavigates)
{
- SdrObject* pObject = reinterpret_cast<SdrObject*>(m_xTreeView->get_selected_id().toInt64());
- if (pObject && pObject->GetName().isEmpty())
+ // Page items in the tree are given user data value 1.
+ // Drawing object items are given user data value of the object pointer they represent.
+ sal_Int64 nUserData = m_xTreeView->get_selected_id().toInt64();
+ if (nUserData != 1)
{
- const bool bUndo = pObject->getSdrModelFromSdrObject().IsUndoEnabled();
- pObject->getSdrModelFromSdrObject().EnableUndo(false);
- pObject->SetName(m_xTreeView->get_selected_text(), false);
- m_aRowActivatedHdl.Call(*m_xTreeView);
- pObject->SetName(OUString(), false);
- pObject->getSdrModelFromSdrObject().EnableUndo(bUndo);
+ SdrObject* pObject = reinterpret_cast<SdrObject*>(nUserData);
+ if (pObject && pObject->GetName().isEmpty())
+ {
+ const bool bUndo = pObject->getSdrModelFromSdrObject().IsUndoEnabled();
+ pObject->getSdrModelFromSdrObject().EnableUndo(false);
+ pObject->SetName(m_xTreeView->get_selected_text(), false);
+ m_aRowActivatedHdl.Call(*m_xTreeView);
+ pObject->SetName(OUString(), false);
+ pObject->getSdrModelFromSdrObject().EnableUndo(bUndo);
+ }
+ else
+ m_aRowActivatedHdl.Call(*m_xTreeView);
}
else
m_aRowActivatedHdl.Call(*m_xTreeView);
More information about the Libreoffice-commits
mailing list