summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-09-28 13:30:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-09-28 14:31:12 +0100
commitc9023860bbf2cc48c85a144eb7bb1f7d0a0fdd9f (patch)
tree3b9df28273ed82bc053c4bcd634542cce8c6858e
parentaf652b80a54526c3cef67813ab8b181612ba737d (diff)
fftester: cut out middle man in deref null ptr and get address
Change-Id: Iba157f47e847cb2eba1d771a6f357019d68b4f13
-rw-r--r--sw/inc/unocrsr.hxx8
-rw-r--r--sw/qa/core/data/rtf/fail/UnoCursor-1.rtfbin0 -> 711 bytes
-rw-r--r--sw/source/core/unocore/unoobj.cxx8
3 files changed, 9 insertions, 7 deletions
diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
index 4af347a7fe0e..e6cbee0e622f 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 000000000000..8b816bdd224e
--- /dev/null
+++ b/sw/qa/core/data/rtf/fail/UnoCursor-1.rtf
Binary files differ
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 1a17693d3dcc..e7515fc93da7 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();