chart2/source/controller/dialogs/ChartTypeDialogController.cxx |    2 -
 chart2/source/inc/ChartTypeDialogController.hxx                |    2 -
 cui/source/inc/border.hxx                                      |    2 -
 cui/source/tabpages/border.cxx                                 |    6 +--
 include/svx/sidebar/LineWidthPopup.hxx                         |    6 +--
 svx/source/sidebar/line/LineWidthPopup.cxx                     |   17 
++++------
 6 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 445703f160b26eade36a0e7a2d8f81eb64a5f212
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 17:36:06 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:11:41 2026 +0100

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

diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 04552874d963..cd8e02e0eef0 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -191,7 +191,7 @@ private:
     void UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset );
 
     static TranslateId GetShadowStringId(sal_uInt16 nIconViewIdx);
-    static VclPtr<VirtualDevice> GetVirtualDevice(Image pPreview);
+    static ScopedVclPtr<VirtualDevice> GetVirtualDevice(Image pPreview);
 };
 
 
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index d7fe2a381389..71d0eecba6ff 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -1449,7 +1449,7 @@ void SvxBorderTabPage::FillPresetIV()
     for( sal_uInt16 nIdx = 1; nIdx <= BORDER_PRESET_COUNT; ++nIdx )
     {
         OUString sId = OUString::number(nIdx);
-        VclPtr<VirtualDevice> pVDev = 
GetVirtualDevice(m_aBorderImgVec[GetPresetImageId(nIdx) - 1]);
+        auto pVDev = GetVirtualDevice(m_aBorderImgVec[GetPresetImageId(nIdx) - 
1]);
         m_xWndPresets->insert(-1, nullptr, &sId, pVDev, nullptr);
     }
 
@@ -1466,7 +1466,7 @@ void SvxBorderTabPage::FillShadowIV()
     for( sal_uInt16 nIdx = 1; nIdx <= BORDER_SHADOW_COUNT; ++nIdx )
     {
         OUString sId = OUString::number(nIdx);
-        VclPtr<VirtualDevice> pVDev = 
GetVirtualDevice(m_aShadowImgVec[nIdx-1]);
+        auto pVDev = GetVirtualDevice(m_aShadowImgVec[nIdx-1]);
         m_xWndShadows->insert(-1, nullptr, &sId, pVDev, nullptr);
     }
 
@@ -1474,7 +1474,7 @@ void SvxBorderTabPage::FillShadowIV()
     m_xWndShadows->select(0);
 }
 
-VclPtr<VirtualDevice> SvxBorderTabPage::GetVirtualDevice( Image pImage )
+ScopedVclPtr<VirtualDevice> SvxBorderTabPage::GetVirtualDevice( Image pImage )
 {
     BitmapEx aPreviewBitmap = pImage.GetBitmapEx();
     VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
commit 6d905b6e36e12e75c183f1de5c45abd803fcf9ef
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 17:19:13 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:11:34 2026 +0100

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

diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx 
b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 377bed719807..b31cbcb759a3 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -389,7 +389,7 @@ void ChartTypeDialogController::setTemplateProperties( 
const uno::Reference< bea
 {
 }
 
-VclPtr<VirtualDevice> ChartTypeDialogController::getVDev(Image pImage)
+ScopedVclPtr<VirtualDevice> ChartTypeDialogController::getVDev(Image pImage)
 {
     BitmapEx aPreviewBitmap = pImage.GetBitmapEx();
     VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
diff --git a/chart2/source/inc/ChartTypeDialogController.hxx 
b/chart2/source/inc/ChartTypeDialogController.hxx
index f491fc094924..10dbfe873f56 100644
--- a/chart2/source/inc/ChartTypeDialogController.hxx
+++ b/chart2/source/inc/ChartTypeDialogController.hxx
@@ -144,7 +144,7 @@ public:
 protected:
     bool bSupportsXAxisWithValues;
     bool bSupports3D;
-    static VclPtr<VirtualDevice> getVDev(Image pPreview);
+    static ScopedVclPtr<VirtualDevice> getVDev(Image pPreview);
 };
 
 class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
commit c4fa736fff954458836e5bebbea8670f76ea27f3
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Feb 21 15:27:52 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Feb 21 16:11:29 2026 +0100

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

diff --git a/include/svx/sidebar/LineWidthPopup.hxx 
b/include/svx/sidebar/LineWidthPopup.hxx
index d8e84ffa0f1d..fafb25d2dfc9 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -61,9 +61,9 @@ private:
     DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
     DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void);
 
-    VclPtr<VirtualDevice> CreateLinePreview(sal_uInt16 nLineWidth, const 
OUString& rText);
-    VclPtr<VirtualDevice> CreateCustomPreview(const Image& rImage, const 
OUString& rText,
-                                              bool bEnabled);
+    ScopedVclPtr<VirtualDevice> CreateLinePreview(sal_uInt16 nLineWidth, const 
OUString& rText);
+    ScopedVclPtr<VirtualDevice> CreateCustomPreview(const Image& rImage, const 
OUString& rText,
+                                                    bool bEnabled);
     void PopulateIconView();
 };
 
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx 
b/svx/source/sidebar/line/LineWidthPopup.cxx
index 803714ba4310..59ff9ced09fb 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -196,15 +196,14 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, 
bool bValuable, MapUnit
         m_bCustom = true;
 
         OUString aStrTip = 
OUString::number(static_cast<double>(m_nCustomWidth) / 10) + m_sPt;
-        VclPtr<VirtualDevice> aCustomVDev = CreateCustomPreview(m_aIMGCus, 
aStrTip, true);
+        auto aCustomVDev = CreateCustomPreview(m_aIMGCus, aStrTip, true);
         m_xIVWidth->set_image(8, aCustomVDev);
         m_xIVWidth->set_text(8, aStrTip);
     }
     else
     {
         m_bCustom = false;
-        VclPtr<VirtualDevice> aCustomVDev
-            = CreateCustomPreview(m_aIMGCusGray, maStrUnits[8], false);
+        auto aCustomVDev = CreateCustomPreview(m_aIMGCusGray, maStrUnits[8], 
false);
         m_xIVWidth->set_image(8, aCustomVDev);
         m_xIVWidth->set_text(8, maStrUnits[8]);
     }
@@ -246,8 +245,8 @@ void LineWidthPopup::GrabFocus()
         m_xMFWidth->grab_focus();
 }
 
-VclPtr<VirtualDevice> LineWidthPopup::CreateLinePreview(sal_uInt16 nLineWidth,
-                                                        const OUString& rText)
+ScopedVclPtr<VirtualDevice> LineWidthPopup::CreateLinePreview(sal_uInt16 
nLineWidth,
+                                                              const OUString& 
rText)
 {
     VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
     pVDev->SetOutputSizePixel(aPreviewSize);
@@ -285,8 +284,8 @@ VclPtr<VirtualDevice> 
LineWidthPopup::CreateLinePreview(sal_uInt16 nLineWidth,
     return pVDev;
 }
 
-VclPtr<VirtualDevice> LineWidthPopup::CreateCustomPreview(const Image& rImage,
-                                                          const OUString& 
rText, bool bEnabled)
+ScopedVclPtr<VirtualDevice>
+LineWidthPopup::CreateCustomPreview(const Image& rImage, const OUString& 
rText, bool bEnabled)
 {
     VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
     pVDev->SetOutputSizePixel(aPreviewSize);
@@ -329,12 +328,12 @@ void LineWidthPopup::PopulateIconView()
     for (sal_uInt16 i = 1; i <= 8; ++i)
     {
         OUString sId = OUString::number(i);
-        VclPtr<VirtualDevice> aPreview = CreateLinePreview(i, maStrUnits[i - 
1]);
+        auto aPreview = CreateLinePreview(i, maStrUnits[i - 1]);
         m_xIVWidth->insert(-1, &maStrUnits[i - 1], &sId, aPreview, nullptr);
     }
 
     OUString sCustomId = OUString::number(9);
-    VclPtr<VirtualDevice> aCustomPreview = CreateCustomPreview(m_aIMGCusGray, 
maStrUnits[8], false);
+    auto aCustomPreview = CreateCustomPreview(m_aIMGCusGray, maStrUnits[8], 
false);
     m_xIVWidth->insert(-1, &maStrUnits[8], &sCustomId, aCustomPreview, 
nullptr);
 }
 

Reply via email to