diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-07-17 13:42:00 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-17 15:33:29 +0200 |
commit | dfba27dd2c6e46c6100f867b83a466e74ddb6dc8 (patch) | |
tree | 86f41171bb42ce727c927239468e839c55db6ca5 /sw | |
parent | ae79f24ce509f6c3cfbdc4cf329f3e04bdc2b017 (diff) |
SwRedlineAcceptDlg::InsertChildren: fix previous commit:
(it = aUsedSeqNo.insert(pParent).first) != aUsedSeqNo.end()) has
undefined behavior due to undefined evaluation order of insert and end.
Change-Id: I8e6f6912cb96c95b60c4fc964dc0f64feaf69265
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/redlndlg.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index 8f6fb5c8db0f..937147ca0753 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -580,17 +580,22 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRe bValidParent = bValidParent && pTable->IsValidEntry(&rRedln.GetAuthorString(), &rRedln.GetTimeStamp(), &rRedln.GetComment()); if (nAutoFmt) { - SwRedlineDataParentSortArr::const_iterator it; - if ( pParent->pData->GetSeqNo() && (it = aUsedSeqNo.insert(pParent).first) != aUsedSeqNo.end() ) // already there + if (pParent->pData->GetSeqNo()) { - if (pParent->pTLBParent) + std::pair<SwRedlineDataParentSortArr::const_iterator,bool> const ret + = aUsedSeqNo.insert(pParent); + if (ret.second) // already there { - pTable->SetEntryText(sAutoFormat, (*it)->pTLBParent, 0); - pTable->RemoveEntry(pParent->pTLBParent); - pParent->pTLBParent = 0; + if (pParent->pTLBParent) + { + pTable->SetEntryText( + sAutoFormat, (*ret.first)->pTLBParent, 0); + pTable->RemoveEntry(pParent->pTLBParent); + pParent->pTLBParent = 0; + } + return; } - return; } bValidParent = bValidParent && bAutoFmt; } |