summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-07 09:13:06 +0000
committerAndras Timar <andras.timar@collabora.com>2017-11-27 12:55:07 +0100
commitc01a48c81115bf8590df346c277728598534a82f (patch)
tree640a0530577c8a21fa0dafcb7cee4d7918b13a08 /sw
parent1e8d8b4fafdda72bafc87ad43a815050f245905a (diff)
ofz#4066 Bad-cast
and a cluster of others around here. This pRedl has been deleted at this point. This doesn't matter for most users, seeing as !LibreOfficeKit::isActive() is the usual case so the deleted pRedl isn't fully accesssed. Because the deleted pRedl won't be found in GetRedlineTable when deleted, rework this a little to avoid the problem. Reviewed-on: https://gerrit.libreoffice.org/44392 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit f0074dd8c6e0040d7f331ba4a42ea6193c0eac99) Change-Id: I5c2f405cdae0b0c804ee7452629a14206516962d
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/redline.hxx3
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx2
-rw-r--r--sw/source/core/doc/docredln.cxx12
-rw-r--r--sw/source/uibase/shells/textfld.cxx2
4 files changed, 10 insertions, 9 deletions
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index f31be5704738..dae29e6e7e7f 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -271,9 +271,10 @@ public:
bool operator<( const SwRangeRedline& ) const;
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
- void MaybeNotifyModification();
};
+SW_DLLPUBLIC void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc);
+
/// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete)
class SW_DLLPUBLIC SwExtraRedline
{
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index c5da74836240..a9fcfb984091 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1243,7 +1243,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall
delete pNewRedl;
pNewRedl = nullptr;
if (eCmpPos == POS_INSIDE)
- pRedl->MaybeNotifyModification();
+ MaybeNotifyRedlineModification(pRedl, &m_rDoc);
break;
case POS_OUTSIDE:
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 9a4f4a583cb2..d30ebdb1cf1f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1043,17 +1043,17 @@ SwRangeRedline::~SwRangeRedline()
delete pRedlineData;
}
-void SwRangeRedline::MaybeNotifyModification()
+void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc)
{
if (!comphelper::LibreOfficeKit::isActive())
return;
- const SwRedlineTable& rRedTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
for (SwRedlineTable::size_type i = 0; i < rRedTable.size(); ++i)
{
- if (rRedTable[i] == this)
+ if (rRedTable[i] == pRedline)
{
- SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, this);
+ SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, pRedline);
break;
}
}
@@ -1064,7 +1064,7 @@ void SwRangeRedline::SetStart( const SwPosition& rPos, SwPosition* pSttPtr )
if( !pSttPtr ) pSttPtr = Start();
*pSttPtr = rPos;
- MaybeNotifyModification();
+ MaybeNotifyRedlineModification(this, GetDoc());
}
void SwRangeRedline::SetEnd( const SwPosition& rPos, SwPosition* pEndPtr )
@@ -1072,7 +1072,7 @@ void SwRangeRedline::SetEnd( const SwPosition& rPos, SwPosition* pEndPtr )
if( !pEndPtr ) pEndPtr = End();
*pEndPtr = rPos;
- MaybeNotifyModification();
+ MaybeNotifyRedlineModification(this, GetDoc());
}
/// Do we have a valid Selection?
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 79863dd95dd9..59ab6bc819ed 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -542,7 +542,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
{
rSh.SetRedlineComment(sCommentText);
GetView().AttrChangedNotify(GetShellPtr());
- const_cast<SwRangeRedline*>(pRedline)->MaybeNotifyModification();
+ MaybeNotifyRedlineModification(const_cast<SwRangeRedline*>(pRedline), pRedline->GetDoc());
break;
}