summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-11 10:38:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-11 11:10:39 +0100
commit6bbdf4dddffd828b38efe8849d7e205f21baaefd (patch)
tree496385c6e5eb488b42ddb28280499cacf1f171b3
parentf3aebf9a3b55cfe558a2ee59f38f0c121f7b65fd (diff)
Resolves: fdo#39995 restore original semantics of GDIMetaFile::ReplaceAction
These semantics are fairly horrific, but existing code expects them, so callers need to be changed if this is changed.
-rw-r--r--vcl/source/gdi/gdimtf.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 6fe6504b8340..faedf86a3e5f 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -340,17 +340,14 @@ MetaAction* GDIMetaFile::NextAction()
MetaAction* GDIMetaFile::ReplaceAction( MetaAction* pAction, size_t nAction )
{
- if ( nAction < aList.size() )
- {
- ::std::vector< MetaAction* >::iterator it = aList.begin();
- ::std::advance( it, nAction );
- (*it)->Delete();
- *it = pAction;
- }
+ if ( nAction >= aList.size() )
+ return NULL;
+ //fdo#39995 This does't increment the incoming action ref-count nor does it
+ //decrement the outgoing action ref-count
+ std::swap(pAction, aList[nAction]);
return pAction;
}
-
// ------------------------------------------------------------------------
GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf )