include/svx/cuicharmap.hxx       |    2 +-
 svx/source/dialog/cuicharmap.cxx |   16 ++++------------
 2 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 300a0fdb26e2dca3b27a6e9aaed3028af2cc5169
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 18:46:00 2026 +0500
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Feb 27 13:14:24 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]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200601
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx
index 6d95238e6c21..bb5535d2009e 100644
--- a/include/svx/cuicharmap.hxx
+++ b/include/svx/cuicharmap.hxx
@@ -93,7 +93,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 066d682039ab..606a02a667a2 100644
--- a/svx/source/dialog/cuicharmap.cxx
+++ b/svx/source/dialog/cuicharmap.cxx
@@ -413,11 +413,8 @@ 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);
+        m_xShowSet->set_image(i, *generateCharGraphic(cChar));
         m_xShowSet->set_item_accessible_description(i, 
getCharacterNameFromId(sId));
-        pVDev.disposeAndClear();
     }
 
     m_xShowSet->thaw();
@@ -491,11 +488,8 @@ 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);
+        m_xSearchSet->set_image(i, *generateCharGraphic(cChar));
         m_xSearchSet->set_item_accessible_description(i, 
getCharacterNameFromId(sId));
-        pVDev.disposeAndClear();
     }
 
     m_xSearchSet->thaw();
@@ -534,7 +528,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));
@@ -1163,14 +1157,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 (!m_isSearchMode)
             m_xShowSet->set_image(pos, *pVDev);
         else
             m_xSearchSet->set_image(pos, *pVDev);
-
-        pVDev.disposeAndClear();
     }
 }
 

Reply via email to