diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-11 10:38:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-11 11:10:39 +0100 |
commit | 6bbdf4dddffd828b38efe8849d7e205f21baaefd (patch) | |
tree | 496385c6e5eb488b42ddb28280499cacf1f171b3 | |
parent | f3aebf9a3b55cfe558a2ee59f38f0c121f7b65fd (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.cxx | 13 |
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 ) |