Kaydet (Commit) 34e8fd7e authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#3537 Direct-leak

Change-Id: Icca25565d396a36154bca0ac748554e95cd83ae9
Reviewed-on: https://gerrit.libreoffice.org/43049Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst e4c4c21d
...@@ -347,27 +347,26 @@ void CGMBitmap::ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& r ...@@ -347,27 +347,26 @@ void CGMBitmap::ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& r
rDest.mndy += rSource.mndy; rDest.mndy += rSource.mndy;
}; };
CGMBitmap* CGMBitmap::GetNext() std::unique_ptr<CGMBitmap> CGMBitmap::GetNext()
{ {
if ( pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus ) std::unique_ptr<CGMBitmap> xCGMTempBitmap;
if (pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus)
{ {
CGMBitmap* pCGMTempBitmap = new CGMBitmap( *mpCGM ); xCGMTempBitmap.reset(new CGMBitmap(*mpCGM));
if ( ( (long)pCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) && if ( ( (long)xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) &&
( ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) && ( ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) &&
( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) || ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) ||
( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) && ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) &&
( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) ) ( xCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) )
{ {
ImplInsert( *(pCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) ); ImplInsert( *(xCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) );
delete pCGMTempBitmap; xCGMTempBitmap.reset();
return nullptr; return xCGMTempBitmap;
} }
pCGMBitmapDescriptor.swap(pCGMTempBitmap->pCGMBitmapDescriptor); pCGMBitmapDescriptor.swap(xCGMTempBitmap->pCGMBitmapDescriptor);
return pCGMTempBitmap;
} }
else return xCGMTempBitmap;
return nullptr;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -83,7 +83,7 @@ public: ...@@ -83,7 +83,7 @@ public:
explicit CGMBitmap( CGM& rCGM ); explicit CGMBitmap( CGM& rCGM );
~CGMBitmap(); ~CGMBitmap();
CGMBitmapDescriptor* GetBitmap() { return pCGMBitmapDescriptor.get();} CGMBitmapDescriptor* GetBitmap() { return pCGMBitmapDescriptor.get();}
CGMBitmap* GetNext(); std::unique_ptr<CGMBitmap> GetNext();
}; };
#endif #endif
......
...@@ -309,11 +309,10 @@ void CGM::ImplDoClass4() ...@@ -309,11 +309,10 @@ void CGM::ImplDoClass4()
if ( mpBitmapInUse ) if ( mpBitmapInUse )
{ {
CGMBitmap* pBmpDesc = mpBitmapInUse->GetNext(); std::unique_ptr<CGMBitmap> xBmpDesc(mpBitmapInUse->GetNext());
if ( pBmpDesc ) // we possibly get a bitmap back which does not fit to if (xBmpDesc) // we possibly get a bitmap back which does not fit to
{ // to the previous -> we need to delete this one too { // to the previous -> we need to delete this one too
mpOutAct->DrawBitmap( pBmpDesc->GetBitmap() ); mpOutAct->DrawBitmap(xBmpDesc->GetBitmap());
delete pBmpDesc;
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment