summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-09 03:06:35 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 07:59:45 +0100
commitb7e30878600b4d03e4102dd743279736c52a70c2 (patch)
treebd62da52fc97fe5d06d77a55a55b7390643dec88 /vcl
parentd846fc0c3bcb03ec422ce7f8227470bb3c5af14c (diff)
prevent insane memory allocation
We release the memory in the next call again. Change-Id: I9cd974f2c1b2381d0a895bea52a8654143862971
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/impbmp.hxx7
-rw-r--r--vcl/source/gdi/impbmp.cxx7
-rw-r--r--vcl/source/outdev/bitmap.cxx3
3 files changed, 15 insertions, 2 deletions
diff --git a/vcl/inc/impbmp.hxx b/vcl/inc/impbmp.hxx
index f6663c5c45d5..bbe80649b23b 100644
--- a/vcl/inc/impbmp.hxx
+++ b/vcl/inc/impbmp.hxx
@@ -38,6 +38,13 @@ private:
public:
ImpBitmap();
+ /**
+ * takes ownership
+ * same as Sequence:
+ * pBmp = new ImpBitmap;
+ * pBmp->ImplSetSalBitmap(pBitmap);
+ */
+ ImpBitmap(SalBitmap* pBitmap);
~ImpBitmap();
void ImplSetSalBitmap( SalBitmap* pSalBitmap );
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index 1ee75d42b442..633cff2a5c64 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -31,6 +31,13 @@ ImpBitmap::ImpBitmap() :
{
}
+ImpBitmap::ImpBitmap(SalBitmap* pBitmap) :
+ mnRefCount ( 1 ),
+ mnChecksum ( 0 ),
+ mpSalBitmap ( pBitmap )
+{
+}
+
ImpBitmap::~ImpBitmap()
{
delete mpSalBitmap;
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index a191b8b2c703..20e6367ac30c 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -457,8 +457,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
if( pSalBmp )
{
- ImpBitmap* pImpBmp = new ImpBitmap;
- pImpBmp->ImplSetSalBitmap( pSalBmp );
+ ImpBitmap* pImpBmp = new ImpBitmap(pSalBmp);
aBmp.ImplSetImpBitmap( pImpBmp );
}
}