sc/source/ui/dbgui/filtdlg.cxx  |    7 +++----
 svx/source/svdraw/svdhdl.cxx    |    2 +-
 test/source/screenshot_test.cxx |    2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 456dbe56de2d883010daa091b868916c055db588
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Feb 23 13:36:07 2026 +0500
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Feb 27 13:46:34 2026 +0100

    fix VirtualDevice GDI handle leaks in ScFilterDlg
    
    Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix
    VirtualDevice GDI handle leaks across IconView callers, 2026-02-21).
    
    Change-Id: Ia5d25a4d316982454bbbe58a9540e0088927c21c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200030
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200605
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 31a6b56aed0b..fe4a12972494 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -135,7 +135,7 @@ ScFilterDlg::~ScFilterDlg()
 }
 
 namespace {
-VirtualDevice* lcl_getColorImage(const Color &rColor)
+ScopedVclPtr<VirtualDevice> lcl_getColorImage(const Color &rColor)
 {
     const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
     Size aImageSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
@@ -157,7 +157,7 @@ VirtualDevice* lcl_getColorImage(const Color &rColor)
 
     xDevice->DrawRect(aRect);
 
-    return xDevice.get();
+    return xDevice;
 }
 }
 
@@ -652,8 +652,7 @@ void ScFilterDlg::UpdateColorList(size_t nList)
         }
         else
         {
-            VirtualDevice* pDev = lcl_getColorImage(rColor);
-            maColorLbArr[nPos]->append(sId, OUString(), *pDev);
+            maColorLbArr[nPos]->append(sId, OUString(), 
*lcl_getColorImage(rColor));
         }
 
         const auto& rItem = rEntry.GetQueryItem();
commit dee0cfb48fc9ce8dab53d60f1eb169fd9fe10b04
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 19:28:03 2026 +0500
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Feb 27 13:46:26 2026 +0100

    fix assorted VirtualDevice GDI handle leaks
    
    Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix
    VirtualDevice GDI handle leaks across IconView callers, 2026-02-21).
    
    Change-Id: I5d0566a2d6c7285c6efde5560f13c1efd22cdc55
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199942
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200604
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 432a12fa0b93..551bc081d390 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1172,7 +1172,7 @@ void SdrHdlColor::CreateB2dIAObject()
 Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
 {
     // get the Bitmap
-    VclPtr<VirtualDevice> pWrite(VclPtr<VirtualDevice>::Create());
+    ScopedVclPtrInstance<VirtualDevice> pWrite;
     pWrite->SetOutputSizePixel(m_aMarkerSize);
     pWrite->SetBackground(aCol);
     pWrite->Erase();
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index d4d84ea538c9..166369a4fddf 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -121,7 +121,7 @@ void ScreenshotTest::saveScreenshot(VclAbstractDialog const 
& rDialog)
 
 void ScreenshotTest::saveScreenshot(weld::Window& rDialog)
 {
-    VclPtr<VirtualDevice> xDialogSurface(rDialog.screenshot());
+    ScopedVclPtr<VirtualDevice> xDialogSurface(rDialog.screenshot());
     const Bitmap aScreenshot(xDialogSurface->GetBitmap(Point(), 
xDialogSurface->GetOutputSizePixel()));
 
     if (!aScreenshot.IsEmpty())

Reply via email to