engine/vcl/inc/animate/AnimationRenderer.hxx | 2
engine/vcl/qa/cppunit/BitmapFilterTest.cxx | 60 ++++++++++-----------------
engine/vcl/qa/cppunit/animationrenderer.cxx | 25 ++++-------
3 files changed, 36 insertions(+), 51 deletions(-)
New commits:
commit fe4442d9c08014d67b9089efe1075a836ca1ce79
Author: Noel Grandin <
noel.g...@collabora.co.uk>
AuthorDate: Thu May 7 13:15:33 2026 +0200
Commit: Michael Stahl <
michae...@collabora.com>
CommitDate: Tue May 12 10:51:51 2026 +0000
fix some trivial leaks in vcl test code
found by running under ASAN with detect_leaks=1
Change-Id: I2c3be259af870de43f56ad7371b6fa7245847312
Reviewed-on:
https://gerrit.collaboraoffice.com/c/online/+/2186
Tested-by: Jenkins CPCI <
rel...@collaboraoffice.com>
Reviewed-by: Michael Stahl <
michae...@collabora.com>
diff --git a/engine/vcl/inc/animate/AnimationRenderer.hxx b/engine/vcl/inc/animate/AnimationRenderer.hxx
index a8d876704fd1..074042333048 100644
--- a/engine/vcl/inc/animate/AnimationRenderer.hxx
+++ b/engine/vcl/inc/animate/AnimationRenderer.hxx
@@ -69,7 +69,7 @@ public:
const Point& rPt, const Size& rSz, sal_uLong nRendererId,
OutputDevice* pFirstFrameOutDev = nullptr );
AnimationRenderer(AnimationRenderer&&) = delete;
- SAL_DLLPRIVATE ~AnimationRenderer();
+ ~AnimationRenderer();
bool matches(const OutputDevice* pOut, tools::Long nRendererId) const;
void drawToIndex( sal_uLong nIndex );
diff --git a/engine/vcl/qa/cppunit/BitmapFilterTest.cxx b/engine/vcl/qa/cppunit/BitmapFilterTest.cxx
index f0191d876d2b..d3f9bb177020 100644
--- a/engine/vcl/qa/cppunit/BitmapFilterTest.cxx
+++ b/engine/vcl/qa/cppunit/BitmapFilterTest.cxx
@@ -333,26 +333,23 @@ void BitmapFilterTest::testMultiplyBlendFilter()
// same color
{
- BitmapMultiplyBlendFilter* pArithmeticFilter
- = new BitmapMultiplyBlendFilter(aRedBitmap, aRedBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapMultiplyBlendFilter aArithmeticFilter(aRedBitmap, aRedBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(2, 2));
}
// different color
{
- BitmapMultiplyBlendFilter* pArithmeticFilter
- = new BitmapMultiplyBlendFilter(aRedBitmap, aGreenBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapMultiplyBlendFilter aArithmeticFilter(aRedBitmap, aGreenBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0x00, 0x00, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
// transparent
{
- BitmapMultiplyBlendFilter* pArithmeticFilter
- = new BitmapMultiplyBlendFilter(aRedBitmap, aTransparentBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapMultiplyBlendFilter aArithmeticFilter(aRedBitmap, aTransparentBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x00, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
@@ -383,26 +380,23 @@ void BitmapFilterTest::testNormalBlendFilter()
// same color
{
- BitmapNormalBlendFilter* pArithmeticFilter
- = new BitmapNormalBlendFilter(aRedBitmap, aRedBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapNormalBlendFilter aArithmeticFilter(aRedBitmap, aRedBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(2, 2));
}
// different color
{
- BitmapNormalBlendFilter* pArithmeticFilter
- = new BitmapNormalBlendFilter(aRedBitmap, aGreenBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapNormalBlendFilter aArithmeticFilter(aRedBitmap, aGreenBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x00, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
// transparent
{
- BitmapNormalBlendFilter* pArithmeticFilter
- = new BitmapNormalBlendFilter(aRedBitmap, aTransparentBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapNormalBlendFilter aArithmeticFilter(aRedBitmap, aTransparentBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x00, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
@@ -480,26 +474,23 @@ void BitmapFilterTest::testLightenBlendFilter()
// same color
{
- BitmapLightenBlendFilter* pArithmeticFilter
- = new BitmapLightenBlendFilter(aRedBitmap, aRedBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapLightenBlendFilter aArithmeticFilter(aRedBitmap, aRedBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(2, 2));
}
// different color
{
- BitmapLightenBlendFilter* pArithmeticFilter
- = new BitmapLightenBlendFilter(aRedBitmap, aGreenBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapLightenBlendFilter aArithmeticFilter(aRedBitmap, aGreenBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x80, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
// transparent
{
- BitmapLightenBlendFilter* pArithmeticFilter
- = new BitmapLightenBlendFilter(aRedBitmap, aTransparentBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapLightenBlendFilter aArithmeticFilter(aRedBitmap, aTransparentBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF),
aResBitmap.GetPixelColor(2, 2));
}
@@ -530,26 +521,23 @@ void BitmapFilterTest::testScreenBlendFilter()
// same color
{
- BitmapScreenBlendFilter* pArithmeticFilter
- = new BitmapScreenBlendFilter(aRedBitmap, aRedBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapScreenBlendFilter aArithmeticFilter(aRedBitmap, aRedBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmap.GetPixelColor(2, 2));
}
// different color
{
- BitmapScreenBlendFilter* pArithmeticFilter
- = new BitmapScreenBlendFilter(aRedBitmap, aGreenBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapScreenBlendFilter aArithmeticFilter(aRedBitmap, aGreenBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0x80, 0x00),
aResBitmap.GetPixelColor(2, 2));
}
// transparent
{
- BitmapScreenBlendFilter* pArithmeticFilter
- = new BitmapScreenBlendFilter(aRedBitmap, aTransparentBitmap);
- Bitmap aResBitmap = pArithmeticFilter->execute();
+ BitmapScreenBlendFilter aArithmeticFilter(aRedBitmap, aTransparentBitmap);
+ Bitmap aResBitmap = aArithmeticFilter.execute();
CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0xFF, 0xFF, 0xFF, 0xFF),
aResBitmap.GetPixelColor(2, 2));
}
diff --git a/engine/vcl/qa/cppunit/animationrenderer.cxx b/engine/vcl/qa/cppunit/animationrenderer.cxx
index f1564e011b90..86a93b609169 100644
--- a/engine/vcl/qa/cppunit/animationrenderer.cxx
+++ b/engine/vcl/qa/cppunit/animationrenderer.cxx
@@ -61,13 +61,12 @@ CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testMatching)
Animation aTestAnim = createAnimation();
ScopedVclPtrInstance<TestRenderingContext> pTestRC;
- AnimationRenderer* pAnimationRenderer
- = new AnimationRenderer(&aTestAnim, pTestRC, Point(0, 0), Size(10, 10), 5);
- CPPUNIT_ASSERT(pAnimationRenderer->matches(pTestRC, 5));
- CPPUNIT_ASSERT(!pAnimationRenderer->matches(pTestRC, 10));
+ AnimationRenderer aAnimationRenderer(&aTestAnim, pTestRC, Point(0, 0), Size(10, 10), 5);
+ CPPUNIT_ASSERT(aAnimationRenderer.matches(pTestRC, 5));
+ CPPUNIT_ASSERT(!aAnimationRenderer.matches(pTestRC, 10));
// caller ID of 0 only matches the OutputDevice
- CPPUNIT_ASSERT(pAnimationRenderer->matches(pTestRC, 0));
+ CPPUNIT_ASSERT(aAnimationRenderer.matches(pTestRC, 0));
}
CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testDrawToPos)
@@ -75,12 +74,11 @@ CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testDrawToPos)
Animation aTestAnim = createAnimation();
ScopedVclPtrInstance<VirtualDevice> pTestRC;
- AnimationRenderer* pAnimationRenderer
- = new AnimationRenderer(&aTestAnim, pTestRC.get(), Point(0, 0), Size(10, 10), 5);
- pAnimationRenderer->drawToIndex(0);
- pAnimationRenderer->drawToIndex(1);
- pAnimationRenderer->drawToIndex(2);
- pAnimationRenderer->drawToIndex(10);
+ AnimationRenderer aAnimationRenderer(&aTestAnim, pTestRC.get(), Point(0, 0), Size(10, 10), 5);
+ aAnimationRenderer.drawToIndex(0);
+ aAnimationRenderer.drawToIndex(1);
+ aAnimationRenderer.drawToIndex(2);
+ aAnimationRenderer.drawToIndex(10);
CPPUNIT_ASSERT_EQUAL(Size(1, 1), pTestRC->GetOutputSizePixel());
}
@@ -90,14 +88,13 @@ CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testGetPosSizeWindow)
Animation aTestAnim = createAnimation();
ScopedVclPtrInstance<TestRenderingContext> pTestRC;
- AnimationRenderer* pAnimationRenderer
- = new AnimationRenderer(&aTestAnim, pTestRC, Point(0, 0), Size(10, 10), 5);
+ AnimationRenderer aAnimationRenderer(&aTestAnim, pTestRC, Point(0, 0), Size(10, 10), 5);
AnimationFrame aAnimBmp(Bitmap(Size(3, 4), vcl::PixelFormat::N24_BPP), Point(0, 0),
Size(10, 10));
Point aPos;
Size aSize;
- pAnimationRenderer->getPosSize(aAnimBmp, aPos, aSize);
+ aAnimationRenderer.getPosSize(aAnimBmp, aPos, aSize);
CPPUNIT_ASSERT_EQUAL(Point(0, 0), aPos);
CPPUNIT_ASSERT_EQUAL(Size(10, 10), aSize);