cui/source/inc/cuitabarea.hxx | 4 ++-- cui/source/tabpages/tpgradnt.cxx | 8 ++++---- cui/source/tabpages/tphatch.cxx | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit 0c3ea778ee186a356ad912a30c0648e8c842531c Author: Mike Kaganski <[email protected]> AuthorDate: Sat Feb 21 17:50:32 2026 +0500 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Feb 27 12:31:18 2026 +0100 fix VirtualDevice GDI handle leaks in SvxHatchTabPage Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix VirtualDevice GDI handle leaks across IconView callers, 2026-02-21). Change-Id: Ifdcc073d3d74aac8732978294fb1e64a600b5c54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199934 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200596 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index e2f9de0efde9..724a1854dd35 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -464,7 +464,7 @@ private: void AddHatch(const OUString& aName, tools::Long nCount); void runNameDialog(VclPtr<AbstractSvxNameDialog> pDlg, tools::Long nCount); - static VclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); + static ScopedVclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); void FillPresetListBox(); void ShowContextMenu(const Point& pPos); void MenuSelect(const OUString& rIdent); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 7502b6d7726d..4f8e3b150d9e 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -153,7 +153,7 @@ void SvxHatchTabPage::FillPresetListBox() OUString sId = OUString::number(nId); Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview(nId, aIconSize); - VclPtr<VirtualDevice> aVDev = GetVirtualDevice(aBitmap); + auto aVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = aVDev->GetBitmap(Point(), aVDev->GetOutputSizePixel()); if (!m_xHatchLB->get_id(nId).isEmpty()) @@ -448,7 +448,7 @@ void SvxHatchTabPage::AddHatch(const OUString& aName, tools::Long nCount) OUString sId = nCount > 0 ? m_xHatchLB->get_id( nCount - 1 ) : OUString(); sal_Int32 nId = !sId.isEmpty() ? sId.toInt32() : -1; Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap); + auto pVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); OUString sName(aName); @@ -532,7 +532,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void) m_pHatchingList->Replace(std::make_unique<XHatchEntry>(aXHatch, aName), nPos); Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap); + auto pVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); m_xHatchLB->remove( nPos ); @@ -550,7 +550,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void) m_nHatchingListState |= ChangeType::MODIFIED; } -VclPtr<VirtualDevice> SvxHatchTabPage::GetVirtualDevice(Bitmap aBitmap) +ScopedVclPtr<VirtualDevice> SvxHatchTabPage::GetVirtualDevice(Bitmap aBitmap) { VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create(); const Point aNull(0, 0); commit 55c335399eed91875effd2c7ca27599ea374941b Author: Mike Kaganski <[email protected]> AuthorDate: Sat Feb 21 17:46:30 2026 +0500 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Feb 27 12:31:06 2026 +0100 fix VirtualDevice GDI handle leaks in SvxGradientTabPage Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix VirtualDevice GDI handle leaks across IconView callers, 2026-02-21). Change-Id: I960e2d8597af34bcd39bc383dbd6079bf5d1c5be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199933 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200595 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 9682c9adc908..e2f9de0efde9 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -383,7 +383,7 @@ private: // MCGR: Preserve ColorStops until we have a UI to edit these basegfx::BColorStops createColorStops(); - static VclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); + static ScopedVclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); void FillPresetListBox(); void ShowContextMenu(const Point& pPos); void MenuSelect(const OUString& rIdent); diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 0dc5feda6e37..a72a8a67c62d 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -151,7 +151,7 @@ void SvxGradientTabPage::FillPresetListBox() OUString sId = OUString::number(nId); Bitmap aBitmap = m_pGradientList->GetBitmapForPreview(nId, aIconSize); - VclPtr<VirtualDevice> aVDev = GetVirtualDevice(aBitmap); + auto aVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = aVDev->GetBitmap(Point(), aVDev->GetOutputSizePixel()); if (!m_xGradientLB->get_id(nId).isEmpty()) @@ -414,7 +414,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) OUString sId = nCount > 0 ? m_xGradientLB->get_id( nCount - 1 ) : OUString(); sal_Int32 nId = !sId.isEmpty() ? sId.toInt32() : -1; Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( nCount, aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap); + auto pVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); m_xGradientLB->insert( nId + 1, &aName, &sId, &aBmp, nullptr); @@ -431,7 +431,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) m_xBtnModify->set_sensitive(true); } -VclPtr<VirtualDevice> SvxGradientTabPage::GetVirtualDevice(Bitmap aBitmap) +ScopedVclPtr<VirtualDevice> SvxGradientTabPage::GetVirtualDevice(Bitmap aBitmap) { VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create(); const Point aNull(0, 0); @@ -472,7 +472,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void) m_pGradientList->Replace(std::make_unique<XGradientEntry>(aBGradient, aName), nPos); Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap); + auto pVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); m_xGradientLB->remove( nPos );
