[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Caolán McNamara
caolanm at redhat.com
Wed Sep 28 13:33:15 UTC 2016
sw/inc/unocrsr.hxx | 8 +++++---
sw/qa/core/data/rtf/fail/UnoCursor-1.rtf |binary
sw/source/core/unocore/unoobj.cxx | 8 ++++----
3 files changed, 9 insertions(+), 7 deletions(-)
New commits:
commit c9023860bbf2cc48c85a144eb7bb1f7d0a0fdd9f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 28 13:30:29 2016 +0100
fftester: cut out middle man in deref null ptr and get address
Change-Id: Iba157f47e847cb2eba1d771a6f357019d68b4f13
diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
index 4af347a..e6cbee0 100644
--- a/sw/inc/unocrsr.hxx
+++ b/sw/inc/unocrsr.hxx
@@ -144,10 +144,12 @@ namespace sw
if(!GetRegisteredIn())
m_pCursor.reset();
};
- SwUnoCursor& operator*() const
- { return *m_pCursor.get(); }
- SwUnoCursor* operator->() const
+ SwUnoCursor* get() const
{ return m_pCursor.get(); }
+ SwUnoCursor* operator->() const
+ { return get(); }
+ SwUnoCursor& operator*() const
+ { return *get(); }
UnoCursorPointer& operator=(UnoCursorPointer aOther)
{
if(aOther.m_pCursor)
diff --git a/sw/qa/core/data/rtf/fail/UnoCursor-1.rtf b/sw/qa/core/data/rtf/fail/UnoCursor-1.rtf
new file mode 100644
index 0000000..8b816bd
Binary files /dev/null and b/sw/qa/core/data/rtf/fail/UnoCursor-1.rtf differ
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 1a17693..e7515fc 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -690,10 +690,10 @@ SwUnoCursor& SwXTextCursor::GetCursor()
{ return *m_pImpl->m_pUnoCursor; }
SwPaM const* SwXTextCursor::GetPaM() const
- { return &(*m_pImpl->m_pUnoCursor); }
+ { return m_pImpl->m_pUnoCursor.get(); }
SwPaM* SwXTextCursor::GetPaM()
- { return &(*m_pImpl->m_pUnoCursor); }
+ { return m_pImpl->m_pUnoCursor.get(); }
SwDoc const* SwXTextCursor::GetDoc() const
{ return m_pImpl->m_pUnoCursor ? m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
@@ -726,8 +726,8 @@ SwXTextCursor::~SwXTextCursor()
void SwXTextCursor::DeleteAndInsert(const OUString& rText,
const bool bForceExpandHints)
{
- auto pUnoCursor = static_cast<SwCursor*>(&(*m_pImpl->m_pUnoCursor));
- if(pUnoCursor)
+ auto pUnoCursor = static_cast<SwCursor*>(m_pImpl->m_pUnoCursor.get());
+ if (pUnoCursor)
{
// Start/EndAction
SwDoc* pDoc = pUnoCursor->GetDoc();
More information about the Libreoffice-commits
mailing list