[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Tue Nov 7 12:28:46 UTC 2017
sw/inc/redline.hxx | 3 ++-
sw/source/core/doc/DocumentRedlineManager.cxx | 2 +-
sw/source/core/doc/docredln.cxx | 12 ++++++------
sw/source/uibase/shells/textfld.cxx | 2 +-
4 files changed, 10 insertions(+), 9 deletions(-)
New commits:
commit f0074dd8c6e0040d7f331ba4a42ea6193c0eac99
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Nov 7 09:13:06 2017 +0000
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.
Change-Id: I5c2f405cdae0b0c804ee7452629a14206516962d
Reviewed-on: https://gerrit.libreoffice.org/44392
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 6092b6650056..1c06d01a214b 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -274,9 +274,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 de092e9b2a0c..434edc95be53 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 == SwComparePosition::Inside)
- pRedl->MaybeNotifyModification();
+ MaybeNotifyRedlineModification(pRedl, &m_rDoc);
break;
case SwComparePosition::Outside:
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 046c3ce4f0e1..a470f2a3fb0a 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1039,17 +1039,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;
}
}
@@ -1060,7 +1060,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 )
@@ -1068,7 +1068,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 1fe73b0478ff..7abb107614ad 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -540,7 +540,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;
}
More information about the Libreoffice-commits
mailing list