include/svx/cuicharmap.hxx              |    2 +-
 include/svx/numvset.hxx                 |    2 +-
 svx/source/dialog/cuicharmap.cxx        |   16 ++++------------
 svx/source/dialog/svxbmpnumvalueset.cxx |    2 +-
 sw/source/ui/frmdlg/column.cxx          |    5 ++---
 sw/source/uibase/inc/column.hxx         |    2 +-
 6 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit 444aae46a0f56a337fc7ef40ad8887379e58c5e9
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 19:14:09 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:12:53 2026 +0100

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

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 2f720778a963..3803b67beaf0 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -496,8 +496,7 @@ void SwColumnPage::InitColumnLayouts()
         OUString aItemText = GetColumnLayoutText(i);
         OUString aItemId = OUString::number(i);
 
-        VclPtr<VirtualDevice> aColumnVDev = CreateColumnLayoutVDev(i + 1);
-        m_xDefaultIV->insert(i, &aItemText, &aItemId, aColumnVDev, nullptr);
+        m_xDefaultIV->insert(i, &aItemText, &aItemId, CreateColumnLayoutVDev(i 
+ 1), nullptr);
     }
 
     m_xDefaultIV->thaw();
@@ -1336,7 +1335,7 @@ void SwColumnPage::SetInSection(bool bSet)
     m_xTextDirectionLB->set_visible(bSet);
 }
 
-VclPtr<VirtualDevice> SwColumnPage::CreateColumnLayoutVDev(sal_uInt16 nItemId)
+ScopedVclPtr<VirtualDevice> SwColumnPage::CreateColumnLayoutVDev(sal_uInt16 
nItemId)
 {
     VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
     const Size aSize(30, 30);
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index ed2c6971f90f..cccb57e741da 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -148,7 +148,7 @@ class SwColumnPage final : public SfxTabPage
 
     void InitColumnLayouts();
     static OUString GetColumnLayoutText(sal_Int32 nId);
-    static VclPtr<VirtualDevice> CreateColumnLayoutVDev(sal_uInt16 nItemId);
+    static ScopedVclPtr<VirtualDevice> CreateColumnLayoutVDev(sal_uInt16 
nItemId);
 
 
     bool isLineNotNone() const;
commit f44facfa5198d397aa513d40bd4a92ef8662dad3
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 18:56:36 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:12:47 2026 +0100

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

diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
index d54ad8f17a19..f271a295d82c 100644
--- a/include/svx/numvset.hxx
+++ b/include/svx/numvset.hxx
@@ -51,7 +51,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
 {
     NumberingPageType ePageType;
     tools::Rectangle       aOrgRect;
-    VclPtr<VirtualDevice> pVDev;
+    ScopedVclPtr<VirtualDevice> pVDev;
 
     css::uno::Reference<css::text::XNumberingFormatter> xFormatter;
     css::lang::Locale aLocale;
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx 
b/svx/source/dialog/svxbmpnumvalueset.cxx
index ed2e9bfaf80a..b19c61d4b0f5 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -404,7 +404,7 @@ FactoryFunction SvxNumValueSet::GetUITestFactory() const
 void SvxNumValueSet::init(NumberingPageType eType)
 {
     ePageType = eType;
-    pVDev = nullptr;
+    pVDev.disposeAndClear();
 
     SetColCount( 4 );
     SetLineCount( 2 );
commit e26365cf6333ca68297ac38ac071b466405cfb9f
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 18:46:00 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:12:39 2026 +0100

    Use ScopedVclPtr in SvxCharacterMap to simplify handling
    
    Change-Id: Ie5c9a3350691d613042257024d0d03c7727c696a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199939
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx
index 42628e4b75b0..25419ef63e43 100644
--- a/include/svx/cuicharmap.hxx
+++ b/include/svx/cuicharmap.hxx
@@ -70,7 +70,7 @@ private:
     void init();
 
     // Character bitmap generation and model population
-    VclPtr<VirtualDevice> generateCharGraphic(sal_UCS4 cChar);
+    ScopedVclPtr<VirtualDevice> generateCharGraphic(sal_UCS4 cChar);
     void clearSearchCharModel();
     void populateShowCharModel();
     void populateSearchCharModel();
diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx
index 9b4eeec9633c..6dedb13647f3 100644
--- a/svx/source/dialog/cuicharmap.cxx
+++ b/svx/source/dialog/cuicharmap.cxx
@@ -407,10 +407,7 @@ void SvxCharacterMap::renderShowSetBatch(sal_Int32 
nStartPos, sal_Int32 nCount)
             continue;
 
         sal_UCS4 cChar = getCharacterFromId(sId);
-        VclPtr<VirtualDevice> pVDev = generateCharGraphic(cChar);
-
-        m_xShowSet->set_image(i, pVDev);
-        pVDev.disposeAndClear();
+        m_xShowSet->set_image(i, generateCharGraphic(cChar));
     }
 
     m_xShowSet->thaw();
@@ -484,10 +481,7 @@ void SvxCharacterMap::renderSearchSetBatch(sal_Int32 
nStartPos, sal_Int32 nCount
             continue;
 
         sal_UCS4 cChar = getCharacterFromId(sId);
-        VclPtr<VirtualDevice> pVDev = generateCharGraphic(cChar);
-
-        m_xSearchSet->set_image(i, pVDev);
-        pVDev.disposeAndClear();
+        m_xSearchSet->set_image(i, generateCharGraphic(cChar));
     }
 
     m_xSearchSet->thaw();
@@ -526,7 +520,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchRenderIdleHdl, 
void*, void)
     }
 }
 
-VclPtr<VirtualDevice> SvxCharacterMap::generateCharGraphic(sal_UCS4 cChar)
+ScopedVclPtr<VirtualDevice> SvxCharacterMap::generateCharGraphic(sal_UCS4 
cChar)
 {
     VclPtr<VirtualDevice> pVirDev = VclPtr<VirtualDevice>::Create();
     pVirDev->SetOutputSizePixel(Size(48, 48));
@@ -1150,14 +1144,12 @@ void 
SvxCharacterMap::rerenderCharacter(std::u16string_view sChar, std::u16strin
     if (it != posMap.end())
     {
         sal_Int32 pos = it->second;
-        VclPtr<VirtualDevice> pVDev = generateCharGraphic(cChar);
+        auto pVDev = generateCharGraphic(cChar);
 
         if (!isSearchMode)
             m_xShowSet->set_image(pos, pVDev);
         else
             m_xSearchSet->set_image(pos, pVDev);
-
-        pVDev.disposeAndClear();
     }
 }
 

Reply via email to