From a42e8baed472933d706578916d00b672bb62dedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 27 Jan 2017 15:55:09 +0000 Subject: [PATCH] we copy the flag for the context in the ctor, but not the context which is worrying, copy the other missing maSwapInfo too which should be safe to do. in the assignment operator, we don't copy any of those three fields at all, which is inconsistent save and restore the context and context flags on the piece where we overwrite ourself via *this = tempobj Change-Id: I06a7d491f95dcb113a3c705ceeb41f576ab0a514 --- vcl/source/gdi/impgraph.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index a82e67a57e02..e9fcfa56d285 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -108,6 +108,8 @@ ImpGraphic::ImpGraphic() : ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) : maMetaFile(rImpGraphic.maMetaFile) , maEx(rImpGraphic.maEx) + , maSwapInfo(rImpGraphic.maSwapInfo) + , mpContext(rImpGraphic.mpContext) , mpSwapFile(rImpGraphic.mpSwapFile) , meType(rImpGraphic.meType) , mnSizeBytes(rImpGraphic.mnSizeBytes) @@ -187,6 +189,10 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) meType = rImpGraphic.meType; mnSizeBytes = rImpGraphic.mnSizeBytes; + maSwapInfo = rImpGraphic.maSwapInfo; + mpContext = rImpGraphic.mpContext; + mbDummyContext = rImpGraphic.mbDummyContext; + mpAnimation.reset(); if ( rImpGraphic.mpAnimation ) @@ -1256,10 +1262,18 @@ bool ImpGraphic::ImplSwapIn( SvStream* xIStm ) std::shared_ptr xSwapFile(std::move(mpSwapFile)); assert(!mpSwapFile); + std::shared_ptr xContext(std::move(mpContext)); + assert(!mpContext); + + bool bDummyContext = mbDummyContext; + mbDummyContext = false; + bRet = ImplReadEmbedded( *xIStm ); - //restore ownership of the swap file + //restore ownership of the swap file and context mpSwapFile = std::move(xSwapFile); + mpContext = std::move(xContext); + mbDummyContext = bDummyContext; if (!bRet) {