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
This commit is contained in:
Caolán McNamara
2017-01-27 15:55:09 +00:00
parent 9bf03203cd
commit a42e8baed4

View File

@@ -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<ImpSwapFile> xSwapFile(std::move(mpSwapFile));
assert(!mpSwapFile);
std::shared_ptr<GraphicReader> 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)
{