Kaydet (Commit) b7e30878 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

prevent insane memory allocation

We release the memory in the next call again.

Change-Id: I9cd974f2c1b2381d0a895bea52a8654143862971
üst d846fc0c
...@@ -38,6 +38,13 @@ private: ...@@ -38,6 +38,13 @@ private:
public: public:
ImpBitmap(); ImpBitmap();
/**
* takes ownership
* same as Sequence:
* pBmp = new ImpBitmap;
* pBmp->ImplSetSalBitmap(pBitmap);
*/
ImpBitmap(SalBitmap* pBitmap);
~ImpBitmap(); ~ImpBitmap();
void ImplSetSalBitmap( SalBitmap* pSalBitmap ); void ImplSetSalBitmap( SalBitmap* pSalBitmap );
......
...@@ -31,6 +31,13 @@ ImpBitmap::ImpBitmap() : ...@@ -31,6 +31,13 @@ ImpBitmap::ImpBitmap() :
{ {
} }
ImpBitmap::ImpBitmap(SalBitmap* pBitmap) :
mnRefCount ( 1 ),
mnChecksum ( 0 ),
mpSalBitmap ( pBitmap )
{
}
ImpBitmap::~ImpBitmap() ImpBitmap::~ImpBitmap()
{ {
delete mpSalBitmap; delete mpSalBitmap;
......
...@@ -457,8 +457,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const ...@@ -457,8 +457,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
if( pSalBmp ) if( pSalBmp )
{ {
ImpBitmap* pImpBmp = new ImpBitmap; ImpBitmap* pImpBmp = new ImpBitmap(pSalBmp);
pImpBmp->ImplSetSalBitmap( pSalBmp );
aBmp.ImplSetImpBitmap( pImpBmp ); aBmp.ImplSetImpBitmap( pImpBmp );
} }
} }
......
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